z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


JUSTIFY

z/OS TSO/E REXX Reference
SA32-0972-00

(Non-SAA Function)

JUSTIFY is a non-SAA built-in function provided only by TSO/E and VM.
Read syntax diagramSkip visual syntax diagram
>>-JUSTIFY(string,length--+------+--)--------------------------><
                          '-,pad-'      

returns string formatted by adding pad characters between blank-delimited words to justify to both margins. This is done to width length (length must be a positive whole number or zero). The default pad character is a blank.

The first step is to remove extra blanks as though SPACE(string) had been run (that is, multiple blanks are converted to single blanks, and leading and trailing blanks are removed). If length is less than the width of the changed string, the string is then truncated on the right and any trailing blank is removed. Extra pad characters are then added evenly from left to right to provide the required length, and the pad character replaces the blanks between words.

Here are some examples:
JUSTIFY('The blue sky',14)       ->    'The  blue  sky'
JUSTIFY('The blue sky',8)        ->    'The blue'
JUSTIFY('The blue sky',9)        ->    'The  blue'
JUSTIFY('The blue sky',9,'+')    ->    'The++blue'

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014