EXEC statement
The JCL line that starts a step. It names the program or procedure to run.
Also written //EXEC
Why it matters. Every step begins with EXEC. Its name is how you find the step in the output, and how later steps refer back to it.
See it
PGM= runs one program. PARM passes it a short text.
Syntax
//stepname EXEC PGM=program[,PARM='text'][,COND=(...)][,REGION=nM][,TIME=n] //stepname EXEC procname[,symbol=value] //stepname EXEC PROC=procname
- PGM=
- Run this program, found in STEPLIB, JOBLIB or the system libraries.
- PROC=
- Run this procedure. The word PROC= can be left out.
- PARM=
- A text string passed to the program.
- COND=
- When to skip the step.
- REGION=
- How much memory the step may use.
- TIME=
- Longest CPU time before the system ends it with S322.
Try it EXEC
- 1
You're editing job CATJOB. Write the EXEC statement of a step called CATLST that runs the program IDCAMS.
JCL //CATLST EXEC PGM=IDCAMS - 2
Submit the job CATJOB from your DEV JCL library.
SUBMIT 'ZB0001.DEV.JCL(CATJOB)' - 3
Read the step messages, JESYSMSG. Find your step name.
OUTPUT CATJOB JESYSMSG
Remember
- EXEC starts a step. PGM= runs a program. A procedure name runs a procedure.
- The step name appears in every message about the step.
- Give each step a name that says what it does.
The usual mistake
//CATLST EXEC IDCAMS
Without PGM=, the system thinks IDCAMS is a procedure and looks for one with that name.
//CATLST EXEC PGM=IDCAMS
On real z/OS
MF/OS parses PGM, PARM, COND, procedure calls and overrides, and runs the programs it knows (IDCAMS, IEBGENER, SORT, IEFBR14, the COBOL compiler and linker, and your own). REGION and TIME are accepted and not enforced.
Where can I practise EXEC statement?
Right here, at ZedBank. You take a junior job at a simulated bank and use EXEC statement in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- JCLJob Control Language: the language used to tell the mainframe what programs to run, in what order, and with what files.
- Job stepOne program execution within a job. A job is simply a sequence of steps that run in order.
- DD statementThe JCL statement that connects a name inside a program to a real dataset outside it.
- PROCA reusable piece of JCL stored as a member and invoked by name, so common steps are written once.
- Utility programA supplied program that performs a standard job such as copying, sorting, comparing or managing datasets, driven by control statements.