The JUSTIFIED Clause

General Format


*

Syntax Rules

  1. The JUSTIFIED clause can be specified only at the elementary item level.
  2. JUST is an abbreviation for JUSTIFIED.
  3. The JUSTIFIED clause cannot be specified for any data item described as numeric or for which editing is specified.
  4. The JUSTIFIED clause cannot be specified for an index data item (see the section The USAGE Clause)

    VSC2MF , or for a pointer data item

    .

  5. OSVSVSC2MF The JUSTIFIED clause cannot be specified for external or internal floating-point data items.

General Rules

  1. 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.

  2. 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.)