Linkage Section

All references to PROCEDURE DIVISION USING in the following discussion also apply to ENTRY USING.

VSC2MF Except as described in the topic The SET Statement in the chapter Procedure Division - SEARCH - WRITE,

the Linkage Section in a program definition is meaningful if, and only if, the object program is to function under the control of a CALL statement, and the CALL statement in the calling program contains a USING phrase.

ISO2002MF The Linkage Section is always meaningful in a function or method.

Formal parameters and returning items described in the Linkage Section of a source element are referred to both by that source element, when it is activated, and by the activating source element.

MF Such data can also be described in the File and Working-Storage Sections .

No storage is allocated for data items defined in the Linkage Section. Procedure Division references to these data items are resolved at run time by equating the reference in the activated runtime element to the location used in the activating runtime element. In the case of index-names, no such correspondence is established. Index-names in the activated and activating runtime element always refer to separate indices.

Data items defined in the Linkage Section of a program can be referenced within the Procedure Division of that program only if they are specified as operands of the USING phrase of the PROCEDURE DIVISION header or are subordinate to such operands, and the object program is under the control of a CALL statement which specifies a USING phrase.

The structure of the Linkage Section is the same as that previously described for the Working-Storage Section, beginning with a section header, followed by data description entries for noncontiguous data items and/or record description entries. The syntax of data description entries is defined in the chapter File Description Entry Skeleton.

Each Linkage Section record-name and noncontiguous item-name must be unique within the source element.

ANS85 These names need not be unique if they are not referenced in the Procedure Division.

The description of the parameters and the returning items that appear in a Linkage Section must follow the rules specified in the topic Conformance for Parameters and Returning Items in the chapter Procedure Division.

Comments:

Noncontiguous Linkage Storage

Items in the Linkage Section that bear no hierarchic relationship to one another need not be grouped into records and are classified and defined as noncontiguous elementary items. Each of these data items is defined in a separate data description entry which begins with the special level-number 77.

The following data clauses are required in each data description entry:

  • Level-number 77
  • Data-name
  • Either
    • The PICTURE clause or
    • the USAGE clause specifying USAGE INDEX ,

      VSC2MF USAGE COMPUTATIONAL-1, USAGE COMPUTATIONAL-2, USAGE POINTER,

      MFCOB370 USAGE PROCEDURE-POINTER,

      ISO2002MF USAGE OBJECT-REFERENCE,

      MF USAGE EVENT-POINTER, MONITOR-POINTER, MUTEX-POINTER, SEMAPHORE-POINTER , THREAD-POINTER

      .

Other data description clauses are optional and can be used to complete the description of the item if necessary.

Linkage Records

Data elements in the Linkage Section which bear a definite hierarchic relationship to one another must be grouped into records according to the rules for formation of record descriptions. Any clause which is used in an input or output record description can be used in a Linkage Section.