Skip to content

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:

  1. 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.
  2. ls-data-description describes the format and size of a data item that has been passed to a CALL’ed subprogram. For more information on the CALL statement, see the paragraph CALL Statement.
  3. Data items declared in the Linkage Section are named in the USING clause of thePROCEDURE DIVISION. For more information on the USING clause, see the Procedure Division Clause section.
  4. Data items declared in the Linkage Section take their initial value from the CALL’ing program. In the cases where the variables are passed BY REFERENCE, their value is returned to the CALL’ing program after processing in the subprogram, and may be changed. For more information on the BY clause, see the Procedure Division Clause section.
  5. The usage of a redefined field in the Linkage Section is allowed. The redefined field may subsequently be referenced in the PROCEDURE 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. 
              
Back to top