Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

LIKE attribute

The LIKE attribute specifies that the name being declared has an organization that is logically the same as the referenced structure or union (object of the LIKE attribute). The object variable’s member names and their attributes, including the dimension attribute, are effectively copied and become members of the name being declared. If necessary, the level-numbers of the copied members are automatically adjusted. The object variable name and its attributes, including the dimension attribute, are ignored.

Read syntax diagramSkip visual syntax diagram>>-LIKE--object-variable---------------------------------------><
 
object-variable
Can be a major structure, a minor structure, or a union. It must be known in the block containing the LIKE attribute specification. It can be qualified but must not be subscripted. The object or any of its members must not have the LIKE attribute or the REFER option.

The objects in all LIKE attributes are associated with declared names before any LIKE attributes are expanded.

New members cannot be added to the created structure or union. Any level-number that immediately follows the object variable in the LIKE attribute must be equal to or less than the level-number of the name with the LIKE attribute.

The following declarations yield the same structure for X.

  dcl
    1 A(10) aligned static,
      2 B    bit(4),
      2 C    bit(4),
    1 X like A;

 
  dcl
    1 X,
      2 B bit(4),
      2 C bit(4);

Notice that the dimension (DIM(10)), ALIGNED, and STATIC attributes are not copied as part of the LIKE expansion.

The LIKE attribute is expanded before the defaults are applied and before the ALIGNED and UNALIGNED attributes are applied to the contained elements of the LIKE object variable.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)