REXX contains the following functions which are useful for formatting
tabular output:
CENTRE (also spelled CENTER)
can be used for format a text string withing a column of a specified
width. For example, CENTRE('Report Title',55) returns a string 55 characters
wide with the string 'Report Title' centred in it.
LEFT
can be used to left-justify a value in a field of a specified width.
For example, LEFT('Thursday',20) returns a string 20 characters long
beginning with the string 'Thursday'.
RIGHT
can be used to right-justify a value in a field of a specified width.
RIGHT('123',20) returns a string 20 characters long with 123 appearing
in the rightmost part. You can also specify a padding character which can
be useful for generated dataset names e.g. RIGHT(yy,2,'0') to ensure that
a year field always appears with two numeric digits in a dataset name even
when the numeric variable yy is less than 10.
FORMAT
can be used to format a numeric value to a specified number of decimal
places. For example, FORMAT('123.45',8,1) returns ' 123.5'; there would
be eight positions to the left of the decimal point and one position after.