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 theDATA(24)
option, or specify the Language Environment® runtime optionHEAP(,,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 theRMODE(24)
orRMODE(AUTO)
option. Consequently, the following items are allocated below the 16 MB line, and can be passed as arguments toAMODE 24
programs:WORKING-STORAGE
data items without theEXTERNAL
clauseFD
record areas- QSAM buffers
- For mixed
AMODE
applications, the Language Environment runtime optionsALL31(OFF)
andSTACK(,,BELOW)
are required. Consequently, theLOCAL-STORAGE SECTION
data items and data items with theEXTERNAL
attributes will be allocated below the 16 MB line, and can be passed as arguments toAMODE 24
programs.