The PARM parameter passes information to a program when it begins execution. It allows you to provide runtime options, control flags, configuration settings, file names, or other parameters that influence how the program operates. The content and format of PARM data depends entirely on what the executing program expects and can interpret.
123//stepname EXEC PGM=program,PARM='parameter-string' //stepname EXEC PROC=procname,PARM='parameter-string' //stepname EXEC PROC=procname,PARM.procstep='parameter-string'
123//stepname EXEC PGM=program, // PARM='long-parameter- // string-continued'
The PARM parameter has the following characteristics:
123456789LINKAGE SECTION. 01 PARM-DATA. 05 PARM-LENGTH PIC S9(4) COMP. 05 PARM-TEXT PIC X(100). PROCEDURE DIVISION USING PARM-DATA. IF PARM-LENGTH > 0 DISPLAY 'Parameter received: ' PARM-TEXT(1:PARM-LENGTH) END-IF.
123456789101112131415MYPROG CSECT SAVE (14,12) SAVE REGISTERS LR R12,R15 ESTABLISH BASE USING MYPROG,R12 ADDRESSABILITY L R2,0(,R1) LOAD PARM ADDRESS LH R3,0(,R2) LOAD PARM LENGTH LTR R3,R3 CHECK IF LENGTH > 0 BZ NOPARM BRANCH IF NO PARM LA R4,2(,R2) POINT TO PARM TEXT * Process parameter data NOPARM EQU * * Continue program
1234567MYPROG: PROCEDURE(PARM) OPTIONS(MAIN); DECLARE PARM CHAR(100) VARYING; PUT SKIP LIST('Parameter received: ' || PARM); /* Process parameter */ END MYPROG;
1//STEP1 EXEC PGM=MYPROG,PARM='DEBUG'
Passes the value 'DEBUG' to program MYPROG
1//STEP2 EXEC PGM=SORT,PARM='CORE=MAX,MSG=CRITICAL'
Passes sort options to the SORT utility
1//STEP3 EXEC PGM=REPORT,PARM='TITLE=Q1''23 RESULTS'
Note the doubled single quote to include an apostrophe in the parameter value
1//STEP4 EXEC PROC=PAYROLL,PARM.CALC='OVERTIME=YES'
Passes 'OVERTIME=YES' to the CALC step within the PAYROLL procedure
12//STEP5 EXEC PGM=ANALYZE,PARM='SOURCE=MAINDATA,TARGET=REPORTING,MODE=BATCH, // VALIDATE=YES,TRACE=ON'
Long parameter string continued on the next line
Utility | Common PARM Options | Example |
---|---|---|
SORT | CORE, MSG, EQUALS, LIST | PARM='CORE=MAX,MSG=AP' |
IDCAMS | GRAPHICS, CATALOG | PARM='GRAPHICS(CHAIN(CH1,CH2))' |
IEBGENER | RECORD, MEMBER, MOD | PARM='RECORD=FB,MEMBER=YES' |
COBOL Compiler | DYNAM, XREF, OPT, NUMPROC | PARM='XREF,OPT(2),SOURCE' |
IEFBR14 | Not typically used | PARM='' (or omitted) |
When using PARM with procedures, you have two options:
1//STEP1 EXEC PROC=PAYROLL,PARM='REGION=WEST'
1//STEP1 EXEC PROC=PAYROLL,PARM.CALC='REGION=WEST',PARM.REPORT='DETAIL=YES'
You can use symbolic parameters within PARM strings for greater flexibility:
1234//PROCSTEP PROC ENV='PROD' //STEP1 EXEC PGM=MYPROG,PARM='ENVIRONMENT=&ENV' // //RUNJOB EXEC PROCSTEP,ENV='TEST'
The PARM value becomes 'ENVIRONMENT=TEST' when the procedure is executed.
For situations where PARM is insufficient or impractical, consider these alternatives:
Alternative | Advantages | Use When |
---|---|---|
SYSIN DD | No length limitation, structured input | Parameters are complex or lengthy |
Parameter datasets | Reusable, shareable, secure | Parameters need to be used across multiple jobs |
System symbols | System-wide consistency | Parameters should be standardized across the system |
STDENV DD | Environment variable-like interface | Working with USS or Java programs |
12//BAD EXEC PGM=REPORT,PARM='TITLE=Q1'23 RESULTS' // ERROR //GOOD EXEC PGM=REPORT,PARM='TITLE=Q1''23 RESULTS' // CORRECT
1//TOOLONG EXEC PGM=PROCESS,PARM='EXTREMELY LONG PARAMETER TEXT THAT CONTINUES FOR MANY CHARACTERS AND WILL LIKELY EXCEED THE LIMITATION OF 100 CHARACTERS WHICH WILL CAUSE JCL ERRORS WHEN SUBMITTED' // ERROR
12//RUN EXEC PROC=MONTHLY,PARM.STEP2='MODE=BATCH' // ERROR if no STEP2 //FIXED EXEC PROC=MONTHLY,PARM.REPORT='MODE=BATCH' // CORRECT if REPORT exists
12345//STEP1 EXEC PGM=ANALYZE,PARM='SOURCE=MAINDATA, TARGET=REPORTING' // ERROR - missing continuation sign //FIXED EXEC PGM=ANALYZE,PARM='SOURCE=MAINDATA, // TARGET=REPORTING' // CORRECT
1//STEP1 EXEC PGM=UTILITY,PARM='UNKNOWN=YES' // Program may ignore or abend