Format data and FORMAT attribute

A format data item is a format constant or a format variable. A format constant is a name written as the label prefix of a FORMAT statement.

The FORMAT attribute specifies that the name being declared is a format variable.
Read syntax diagramSkip visual syntax diagram
>>-FORMAT------------------------------------------------------><

A name declared with the FORMAT attribute can have another format variable or a format constant assigned to it. When such an assignment is made, the environment of the source label is assigned to the target.

To maintain compatibility between other PL/I compilers, format variables may be declared as label variables.

Consider the following example:
  Prntexe: format
              ( column(20),A(15), column(40),A(15), column(60),A(15) );
  Prntstf: format
              ( column(20),A(10), column(35),A(10), column(50),A(10) );
Prntexe and Prntstf are the format constants.
A second example indicates that  4  and  5  have the same effect as  2 , and  6  and  7  have the same effect as  3 .
 1   dcl Print format;
 2   put edit (X,Y,Z) (R(Prntexe) );
 3   put edit (X,Y,Z) (R(Prntstf) );
 4   Print = Prntexe;
 5   put edit (X,Y,Z) (R(Print) );
 6   Print = Prntstf;
 7   put edit (X,Y,Z) (R(Print) );