EXEC Keyword parameters

PGM

This parameter is the simplest way of defining what program should be run in this step.
PGM=SORT will give the instruction to look in the system program libraries for the program SORT Once found it would be loaded and executed.

If the program is not found in the default libraries, you will need to specify a JOBLIB or STEPLIB with the DD statement beforehand.
STEPLIB performs the same action as JOBLIB, but only for a single step.

You might use the PGM parameter to refer to a previous step in the program
PGM=*.COMP.SYSLMOD would indicate that the program to load should be the same as in the COMP statement earlier
Pasted image 20240929160829.png

PROC

JCL overview#Running a procedure
Apart from the method covered here, procedures can be called with the PROC parameter.

REGION

This parameter is the same as the JOB statement version of REGION and uses the same syntax. The difference being that it applies to the scope of the specific program and not the entire job.
If applying to a procedure, you can also specify the procedure step name after the parameter name
REGION.STEPNAME=4M

If used for both job statement and exec statement. In this case JOB statement will override the exec statement equivalent.

COND

This parameter also makes a return, it is used to define with more specificity if the step of the job should run. The syntax of it is the same as for the JOB statement.
When applied to the EXEC statement it will not run the step if the condition is fulfilled

For example EXEC PGM=TEST,COND=(0,NE) will only run the program TEST if the steps before it have returned the code of 0

It can be quite confusing to understand how this parameter operates

PARM

This parameter can be used to supply additional parameters to the executable that will be executed as part of the current step. For example the program might be a capable of performing many tasks based on the parameters provided.

PARM=‘LIST,XREF’ will pass the parameters to the executable

The value of the PARM parameter can be up to 100 characters. if you for some reason need to provide a longer parameter you can continue the parameters in a new line as per the usual rules of continuing on a new line.

Multiple parameters can be passed via this method and need to be separated by a comma. (All of them need to be in a single quote)

If you enter incorrect parameters into the PARM parameter, most of the time the program that will be executed as part of this step will simply be programmed to ignore them.

If your parameters have special characters use both brackets and single quotes, brackets for all, single quotes for the one with special characters.

If you EXEC statement calls a procedure instead of a singular program, you can still use the PARM parameter to pass something to just a specific executable within that procedure
PARM.NAMEOFSTEP=(TEST1,TEST2) Note that the brackets are used and not just single quotes

PARMDD

This parameter can be used to „outsource„ the parameters to another line - you can use the name of a different step where the parameters should be taken from, FOR EXAMPLE A DATASET
Note that it cannot be used together with the PARM parameter.

TIME

This parameter also makes an appearance and can be used the same was as for the JOB statement, just with the scope being reduced to the step instead.