Alignment rules
The standard alignment rules for positioning data in an elementary item depend on the category of a receiving item.
A receiving item is an item into which the data is moved. For more details about a receiving item, see Elementary moves.
- Numeric
- For numeric receiving items,
the following rules apply:
- The data is aligned on the assumed decimal point and, if necessary, truncated or padded with zeros. (An assumed decimal point is one that has logical meaning but that does not exist as an actual character in the data.)
- 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.
- Internal floating-point
- A decimal point is assumed immediately to the left of the field. The data is then aligned on the leftmost digit position that follows the decimal point, with the exponent adjusted accordingly.
- External floating-point
- The data is aligned on the leftmost digit position; the exponent is adjusted accordingly.
- Alphanumeric, alphanumeric-edited, alphabetic, DBCS
- For these receiving
items, the following rules apply:
- The data is aligned at the leftmost character position, and (if necessary) truncated or padded with spaces at the right.
- If the JUSTIFIED clause is specified for this receiving item, the above rule is modified as described in JUSTIFIED clause.
- National, national-edited
- For these receiving items, the following rules apply:
- The data is aligned at the leftmost character position, and (if necessary) truncated or padded with default Unicode spaces (NX'2000') at the right. Truncation occurs at the boundary of a national character position.
- If the JUSTIFIED clause is specified for this receiving item, the above rule is modified as described in JUSTIFIED clause.
- Date, time, timestamp
- For these receiving
items, the following rules apply:
- 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.
- 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.