ALIGNED and UNALIGNED Attributes

ALIGNED and UNALIGNED are optional data type attributes that control the storage boundary of data.

ALIGNED allows the Compiler to align the data on an implementation-defined storage boundary, with the possible side effect that more bits of storage are used than specified by the declared length. (Refer to your Open PL/I User's Guide for more information.)

UNALIGNED allows the Compiler to align the data on the next byte boundary (or, in the case of fixed-length bit strings, the next bit) rather than on implementation-defined storage boundaries. This can reduce storage requirements.

ALIGNED or UNALIGNED can be specified for scalar, array, or structure variables. The application of either attribute to a structure is equivalent to applying the attribute to all contained elements that do not have explicit alignment declaration. Operations on ALIGNED data tend to be more efficient; operations on UNALIGNED data usually are slower. They are considered part of the data type for purposes of argument/parameter matching and storage sharing.

The UNALIGNED attribute is the default for non-varying character data types and bit data types, while ALIGNED is the default for all other data types.

The UNALIGNED attribute has no effect with an AREA variable, which is always aligned on an 8-byte boundary.

See the Open PL/I User's Guide for specific alignment of varying character strings.