The JUSTIFIED clause specifies non-standard positioning of data within a receiving data item.
General Format
General Rules
- When a receiving data item is described with the JUSTIFIED clause and the sending data item is larger than the receiving data
item, the leftmost characters are truncated. When the receiving data item is described with the JUSTIFIED clause and it is
larger than the sending data item, the data is aligned at the rightmost character position in the data item with space fill
for the leftmost character positions.
The contents of the sending data item are not taken into account, that is, trailing spaces within the sending data item are
not suppressed.
For example, if a data item PIC X(4) whose value is
"A " (that is, A followed by three spaces) is moved into a data item PIC X(6) JUSTIFIED the result is
" A ". If the same data item is moved to one with PIC X(3) JUSTIFIED the result is
" " that is, the leftmost character is truncated.
- When a USAGE NATIONAL receiving data item is described with the JUSTIFIED clause and the sending data item is smaller than
the receiving item, each unused position is filled with default UTF-16 spaces (NX'0020'). When a USAGE UTF-81 receiving data item is described with the JUSTIFIED clause and the sending data item is smaller than the receiving item,
each unused position is filled with default UTF-8 spaces (UX'20'). For all other USAGE cases, the unused positions are filled
with alphanumeric spaces.
- When the JUSTIFIED clause is omitted, the standard rules for aligning data within an elementary item apply. (See the topic
Standard Alignment Rules in the chapter
Concepts of the COBOL Language.)