COBOL Manual for TNS/E Programs (H06.03+)

Data Division
HP COBOL Manual for TNS/E Programs520347-003
7-40
Index-Names
Index-Names
A Procedure Division reference to a Linkage Section data item in the called program
refers to a location in the calling program; however, this convention does not extend to
index-names. The index-name of a table in the calling program and the index-name of
a table in the called program always refer to separate indexes. This remains true even
when the names of the indexes are the same in the calling program and the Linkage
Section of the called program. An index-name’s value can be passed if it is saved in a
separate item and then passed. (See the example under CALL
.)
Example 7-7. Correspondence Between Formal and Actual Parameters
These lines are in the calling program:
WORKING-STORAGE SECTION.
01 PARAMETER-TABLE.
02 ROW-PART OCCURS 20 TIMES.
03 COL-PART PIC 9999 COMPUTATIONAL
OCCURS 10 TIMES.
...
77 ROW PIC 99 COMPUTATIONAL.
77 COL PIC 99 COMPUTATIONAL.
...
PROCEDURE DIVISION.
...
CALL "SUBPROG1" USING ROW,
COL,
PARAMETER-TABLE.
...
These lines are in the called program:
LINKAGE SECTION.
01 PARM-3-IN-OUT.
04 FORMAL-ROW OCCURS 20 TIMES.
07 FORMAL-COLUMN PIC 9999 COMPUTATIONAL
OCCURS 10 TIMES.
77 PARM-R PIC 99 COMPUTATIONAL.
88 ROW-WITHIN-RANGE VALUE IS 1 THROUGH 20.
77 PARM-C PIC 99 COMPUTATIONAL.
88 COLUMN-WITHIN-RANGE VALUE IS 1 THROUGH 10.
...
PROCEDURE DIVISION USING PARM-R, PARM-C, PARM-3-IN-OUT.
...