Describing arguments in the calling program

In the calling program, describe arguments in the DATA DIVISION in the same manner as other data items in the DATA DIVISION.

About this task

Storage for arguments is allocated only in the outermost program. For example, program A calls program B, which calls program C. Data items are allocated in program A. They are described in the LINKAGE SECTION of programs B and C, making the one set of data available to all three programs.

If you reference data in a file, the file must be open when the data is referenced.

Code the USING phrase of the CALL statement to pass the arguments. If you pass a data item BY VALUE, it must be an elementary item.

To pass CALL arguments from AMODE 31 programs to AMODE 24 programs, you must ensure that the arguments are in storage below the 16 MB line to be addressed by the AMODE 24 subprogram.
  • For reentrant AMODE 31 programs, compile the program with the DATA(24) option, or specify the Language Environment® runtime option HEAP(,,BELOW) if WORKING-STORAGE is allocated from HEAP storage. For more information about when WORKING-STORAGE is allocated from HEAP storage, see Storage and its addressability.
  • For nonreentrant programs that are compiled with the NORENT option, compile with the RMODE(24) or RMODE(AUTO) option. Consequently, the following items are allocated below the 16 MB line, and can be passed as arguments to AMODE 24 programs:
    • WORKING-STORAGE data items without the EXTERNAL clause
    • FD record areas
    • QSAM buffers
  • For mixed AMODE applications, the Language Environment runtime options ALL31(OFF) and STACK(,,BELOW) are required. Consequently, the LOCAL-STORAGE SECTION data items and data items with the EXTERNAL attributes will be allocated below the 16 MB line, and can be passed as arguments to AMODE 24 programs.

Related concepts  
Storage and its addressability  

Related references  
The USING phrase (Enterprise COBOL for z/OS® Language Reference)