******************************************************************
* STRING JUSTIFICATION ROUTINES CALLING PROGRAM *
* (JUST70CP) *
* *
* This is the calling program for routines contained within *
* JUST70PD which perform string justification with minor *
* error checking. *
* The routine will left justify or right justify a string, or *
* it will also format a string to a numeric format by adding *
* the appropriate number of leading zeroes. *
* INPUT FIELDS: *
* ------------- *
* Required: *
* JSTWS-FUNCTION-FL.......88 level variable used to *
* indicate type of justification *
* to be performed. Use the cobol *
* sentence format: *
* SET JSTWS-RIGHT TO TRUE *
* Valid functions: *
* JSTWS-LEFT (Default) *
* JSTWS-RIGHT *
* JSTWS-NUMERIC *
* JSTWS-STR.............. String to be justified *
* Maximum length of 50 characters *
* Required for Right and Numeric *
* JSTWS-STR-LEN...........Length of field to be justified *
* Optional: *
* JSTWS-STR-OUT-LEN.......Length of string to be returned *
* if different from input string *
* If actual length of text from *
* input string is greater than *
* this length, an error will be *
* indicated by JSTWS-ERROR-FL *
* JSTWS-ZERO-FILL-FL......Used to request that leading *
* zeroes be added to the return *
* string (done automatically when *
* JSTWS-NUMERIC function used) *
* Use: SET JSTWS-ZERO-FILL TO TRUE*
* If, for some reason, a numeric *
* should be returned without *
* leading zeroes, use: *
* SET JSTWS-NO-ZERO-FILL TO TRUE *
* JSTWS-REMOVE-0-FL.......Used to request that leading *
* zeroes not be removed from the *
* input string before justifying *
* (this routine removes leading *
* zeroes by default) *
* Use: SET JSTWS-NO-REMOVE-0 TO *
* TRUE *
* OUTPUT FIELDS: *
* -------------- *
* JSTWS-STR-OUT...........Justified string returned *
* JSTWS-ERROR-FL..........88 level flag with fields *
* JSTWS-ERROR *
* JSTWS-NO-ERROR *
* Valid Function Flags: *
* This function will left justify a text string. Leading *
* zeroes are removed unless the JSTWS-NO-REMOVE-0 flag is *
* set to TRUE. (see the function "NUMERIC " for more *
* information on formatting numeric strings). *
* Usage Example: *
* MOVE POWS-LOCATION TO JSTWS-STR . *
* SET JSTWS-LEFT TO TRUE. *
* PERFORM 2000-JUSTIFY-OBJECT. *
* MOVE JSTWS-STR-OUT TO POWS-LOCATION. *
* Example Results: *
* In: " K500" Out: "K500 " *
* In: "000123456" Out: "123456 " *
* This function will right justify the input string to *
* the size specified in JSTWS-STR-LEN, unless an alternate*
* value is indicated in JSTWS-STR-OUT-LEN. For example, *
* if input string and length is "abc " and 5, the output *
* string would be " abc". If JSTWS-STR-OUT-LEN of 10 *
* were specified in the same scenario, the output string *
* would be " abc". *
* MOVE POWS-NAME TO JSTWS-STR. *
* MOVE 10 TO JSTWS-STR-LEN. *
* SET JSTWS-RIGHT TO TRUE. *
* MOVE JSTWS-STR-OUT TO RQWS-NAME. *
* The purpose of this function is to format a string of *
* characters that represent numeric data. *
* Output will be right justified to the size passed in *
* JSTWS-STR-LEN unless a different size is requested by *
* filling JSTWS-STR-OUT-LEN. *
* Leading zeroes will be added to fill the string unless *
* JSTWS-NO-ZERO-FILL is set to TRUE (result would be a *
* right justified numeric string with leading spaces). *
* An error is returned if any of the characters in the *
* string are non-numeric, if more than one decimal point *
* exists, or if imbedded spaces exist. *
* MOVE HL7WS-COMPANY TO JSTWS-STR. *
* MOVE 05 TO JSTWS-STR-OUT-LEN. *
* SET JSTWS-NUMERIC TO TRUE. *
* MOVE JSTWS-STR-OUT TO RQWS-COMPANY. *
* Input string: " 340" *
* Output string: "00340" *