DATA DIVISION
LINKAGE SECTION
The Linkage Section contains descriptions of data items that have been passed to a CALL’ed subprogram.
General Format:
[ LINKAGE SECTION. ]
[ lk-data-level lk-data-description ] …
Syntax:
The clauses supported by the data description are described in the Data Description section.
General Rules:
ls-data-levelis a data level number between 01 and 49 (inclusive), 66, 77, 78, or 88. For more information about data level numbers, see the Data Level Numbers section.ls-data-descriptiondescribes the format and size of a data item that has been passed to aCALL’ed subprogram. For more information on theCALLstatement, see the paragraph CALL Statement.- Data items declared in the
LinkageSection are named in theUSINGclause of thePROCEDURE DIVISION. For more information on theUSINGclause, see the Procedure Division Clause section. - Data items declared in the
LinkageSection take their initial value from theCALL’ing program. In the cases where the variables are passedBY REFERENCE, their value is returned to theCALL’ing program after processing in the subprogram, and may be changed. For more information on theBYclause, see the Procedure Division Clause section. - The usage of a redefined field in the
LinkageSection is allowed. The redefined field may subsequently be referenced in thePROCEDURE DIVISION USINGclause.
Code Sample:
LINKAGE SECTION.
01 X PIC X(4) VALUE 'ABCD'.
01 G REDEFINES X.
02 A PIC X(2).
02 B PIC X(2).
…
PROCEDURE DIVISION USING G.
…