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-level
is 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-description
describes the format and size of a data item that has been passed to aCALL
’ed subprogram. For more information on theCALL
statement, see the paragraph CALL Statement.- Data items declared in the
Linkage
Section are named in theUSING
clause of thePROCEDURE DIVISION
. For more information on theUSING
clause, see the Procedure Division Clause section. - Data items declared in the
Linkage
Section 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 theBY
clause, see the Procedure Division Clause section. - The usage of a redefined field in the
Linkage
Section is allowed. The redefined field may subsequently be referenced in thePROCEDURE DIVISION USING
clause.
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.
…