ILE COBOL Language Reference

Alignment Rules

The standard alignment rules for positioning data in an elementary item depend on the category of a receiving item (that is, an item into which the data is moved; see Elementary Moves).

Numeric

  1. The data is aligned on the assumed decimal point and if necessary, truncated or padded with zeros. (An assumed decimal point - PICTURE character P or V - is one that has logical meaning but that does not exist as an actual character in the data.)
  2. If an assumed decimal point is not explicitly specified, the receiving item is treated as though an assumed decimal point is specified immediately to the right of the field. The data is then treated according to the preceding rule.

Numeric-edited

The data is aligned on the decimal point, and (if necessary) truncated or padded with zeros at either end, except when editing causes replacement of leading zeros.

However, if the LOCALE phrase of the PICTURE clause is specified in its data description entry, alignment and zero-fill or truncation takes place as described in LOCALE Phrase.

+-------------------------------IBM Extension--------------------------------+

Internal Floating-point

A decimal point is assumed immediately to the left of the field. The data is aligned then on the leftmost digit position following the decimal point, with the exponent adjusted accordingly.

+----------------------------End of IBM Extension----------------------------+

+-------------------------------IBM Extension--------------------------------+

External Floating-point

The data is aligned on the leftmost digit position; the exponent is adjusted accordingly.

+----------------------------End of IBM Extension----------------------------+

Alphanumeric, Alphanumeric-edited, Alphabetic

  1. The data is aligned at the leftmost character position, and (if necessary) truncated or padded with spaces to the right.
  2. If the JUSTIFIED clause is specified for this receiving item, the above rule is modified as described in JUSTIFIED Clause.

    +-------------------------------IBM Extension--------------------------------+

  3. For a DBCS receiving item the data is aligned at the leftmost character position, and (if necessary) truncated or padded with DBCS spaces to the right.
  4. If the JUSTIFIED clause was specified for the DBCS receiving item, the above rule is modified as described in JUSTIFIED Clause.
  5. For a national receiving item the data is aligned at the leftmost character position, and (if necessary) truncated or padded with national (UCS-2) spaces to the right.
  6. If the JUSTIFIED clause was specified for the national receiving item, the above rule is modified as described in JUSTIFIED Clause.

    +----------------------------End of IBM Extension----------------------------+

+-------------------------------IBM Extension--------------------------------+

Date, Time, and Timestamp

  1. For class date-time items with a USAGE of DISPLAY, data is aligned at the leftmost character position, and (if necessary) padded with spaces to the right.
  2. For class date-time items with a USAGE of PACKED-DECIMAL, data is aligned at the rightmost digit position, and (if necessary) padded with zeros to the left.

+----------------------------End of IBM Extension----------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]