EXEC Statement

Purpose

The EXEC statement identifies the beginning of a job step and specifies either a program to be executed or a cataloged/in-stream procedure to be used.

Syntax

jcl
1
2
3
//stepname EXEC PGM=program-name[,parameter[,parameter]...] //stepname EXEC PROC=procedure-name[,parameter[,parameter]...] //stepname EXEC procedure-name[,parameter[,parameter]...]

Key Parameters

  • stepname - A 1-8 character name that identifies the job step. Must begin with an alphabetic (A-Z) or national (@, #, $) character.
  • PGM=program-name - The name of the program to be executed.
  • PROC=procedure-name or procedure-name - The name of a cataloged or in-stream procedure to be executed.

Common Parameters

  • PARM='parameter-string' - Passes parameters to the program being executed
  • COND=(code,comparison-operator) - Conditional execution based on return codes
  • TIME=minutes or TIME=(minutes,seconds) - Maximum execution time for this step
  • REGION=nnnK or REGION=nnnM - Memory allocation for this step
  • ADDRSPC=REAL/VIRT - Controls whether the step uses real or virtual storage
  • DPRTY=(dispatching-priority,time-slice-priority) - Dispatching priority for the step
  • PERFORM=n - Performance group for the step

Examples

Executing a Program

jcl
1
2
3
4
5
6
//STEP01 EXEC PGM=IEFBR14 //STEP02 EXEC PGM=SORT, // PARM='FIELDS=COPY', // REGION=4M, // TIME=5

Executing a Procedure

jcl
1
2
3
4
5
//STEP03 EXEC PROC=PAYROLL, // REGION=6M //STEP04 EXEC BILLING, (abbreviated form without PROC=) // PARM='MONTHLY'

Notes

  • Each job step must start with an EXEC statement
  • JCL allows up to 255 job steps in a single job
  • PROC= is optional when specifying a procedure name
  • Parameters can override values in cataloged procedures using step.ddname and step.procstep.ddname formats
  • Step-level parameters can override job-level parameters

Related Concepts