EXEC PARM Parameter
The PARM parameter is used to pass the input data from the JOB step to the program. PARM parameter always comes with an EXEC statement, and it is optional.
How to pass data from JCL to Program -
Below diagram explains how the JCL PARM data passes to the program
COBOL program receives the PARM using the PROCEDURE DIVISION. The input data passed through the PARM variable received by the variables should declare in LINKAGE SECTION.
The variables declared in COBOL should have a length variable (S9(04) COMP) for storing data length and another variable for storing the data.
If the PARM data exceeds a line in JCL, the second line should start from the 16th position.
Simple PARM Parameter -
PARM=input-data
input-data | Specifies the data to be passed to the program. We can pass a maximum of 100 characters. Quotes, parentheses, and commas are not counted within 100 characters. Commas in the quotes are part of 100 characters. |
Examples -
Scenario - Passing single numeric value to the program.
//STEP01 EXEC PGM=NEWPROG,PARM=47
We are passing input value 47 from JCL to the program NEWPROG.
PARM Parameter for PROCs -
If JCL is coded with a PROC and needs to pass the data to the PROC, the PARM parameter should code with the EXEC statement of the PROC.
PARM[.step-name-of-proc]=input-data
step-name-of-proc | Specifies the step name of the PROC to which step the value should pass. The PARM parameter should code with a specific step name in the PROC to avoid confusion. |
Examples -
Scenario - Passing a value to the PROC.
//STEP01 EXEC PROC=NEWPROC,PARM=47
We are passing input value 47 to the procedure NEWPROC and assumes it has only one step.