COPY (ANSI'68 or LANGLVL(1) Variation)

The COPY statement's behavior is slightly modified when the OLDCOPY Compiler directive is set. This modification changes it from acting as defined by the ANSI'74 and ANSI'85 standards to behaving as the old ANSI'68 standard defined. This modified behavior is also consistent with how OS/VS COBOL and DOS/VS COBOL behave when the LANGLVL(1) compiler option is used on an IBM mainframe.

When the OLDCOPY Compiler directive is set and a copy member is intended to include an entire 01 level data description, both the COPY statement and the copied description should be defined with an 01 level item. However, only the data name from the copying statement will be available to the rest of the COBOL program. For example:

Source file Code.

 01   PRODUCT-CODE COPY COPYPROD.

Copybook Code "COPYPROD":

 01   PROD-CD.
     05   ITEM-NAME      PIC X(30).
     05   ITEM-NUMBER    PIC X(5).

Resulting COBOL Code:

 01   PRODUCT-CODE.
     05   ITEM-NAME      PIC X(30). 
     05   ITEM-NUMBER    PIC X(5).