Accessing JCL parameters
You can pass a parameter string from JCL to a COBOL program
using the PARM=
keyword of the EXEC
statement.
You can access these parameters either by standard COBOL coding, or
by calling the CEE3PR2
Language Environment® callable service.
Using COBOL coding
You must define the LINKAGE
SECTION
record (level-01) that is to receive the user_parameter data
passed by the PARM
string, taking into account the
halfword parameter list length field that is inserted in front of
the string by the system.
The program can test this field length for nonzero to verify that PARM-string data has in fact been passed. For example:
LINKAGE SECTION.
01 PARMDATA.
05 STRINGLEN PIC 9(4) USAGE COMP.
05 STRINGPARM PIC X(80).
PROCEDURE DIVISION USING PARMDATA.
IF STRINGLEN > 0 . . .
For more information, see Coding the LINKAGE SECTION.
Using CEE3PR2
You
must define parameters to the CEE3PR2
callable service,
without the need to add parameters to your PROCEDURE DIVISION
USING
statement.
WORKING-STORAGE SECTION.
01 PARMLEN PIC S9(9) BINARY.
01 PARMSTR.
02 STR1-LENGTH PIC S9(4) BINARY.
02 STR1-STRING.
03 STR1-CHAR PIC X
OCCURS 0 TO 256 TIMES
DEPENDING ON STR1-LENGTH.
. . .
CALL "CEE3PR2" USING PARMLEN,PARMSTR, FC.
For
more information about the CEE3PR2
callable service,
see CEE3PR2
in the Language
Environment Programming Reference.