🖥 JCL
JCL EXEC Statement
Beginner 🕑 18 min read
👁 1 views
EXEC Statement Overview
The EXEC statement identifies the program or procedure to be executed in a job step.
EXEC Statement Formats
- PGM= - Execute a program
- PROC= - Execute a cataloged procedure
- Procedure name without PROC=
Common EXEC Parameters
| Parameter | Description |
|---|---|
| PGM | Program name to execute |
| PROC | Procedure name to execute |
| PARM | Parameters passed to program |
| COND | Condition code testing |
| TIME | Step time limit |
| REGION | Step memory allocation |
| ACCT | Step accounting information |
COND Parameter
Controls step execution based on return codes:
COND=(code,operator) COND=(code,operator,stepname) COND=EVEN - Execute even if previous step abends COND=ONLY - Execute only if previous step abends
Operators for COND
- GT - Greater than
- GE - Greater than or equal
- LT - Less than
- LE - Less than or equal
- EQ - Equal
- NE - Not equal
PARM Parameter
Pass parameters to programs:
PARM="parameter string" PARM=(parm1,parm2)
Code Example
//STEP01 EXEC PGM=IEFBR14
//*
//STEP02 EXEC PGM=MYCOBOL,
// PARM="PARAM1,PARAM2",
// TIME=(5,30),
// REGION=64M
//*
//STEP03 EXEC PGM=SORTPGM,
// COND=(4,LT,STEP02)
//*
//* COND EXAMPLES
//STEP04 EXEC PGM=PROG1,COND=(0,NE)
//* Skip if any previous RC not equal to 0
//*
//STEP05 EXEC PGM=PROG2,COND=((4,LT),(8,EQ,STEP02))
//* Skip if RC < 4 OR STEP02 RC = 8
//*
//STEP06 EXEC PGM=CLEANUP,COND=EVEN
//* Execute even if previous step abended
//*
//STEP07 EXEC PGM=ERRRPT,COND=ONLY
//* Execute only if previous step abended
//*
//* EXECUTING A PROCEDURE
//STEP08 EXEC PROC=COBCLG
// or
//STEP08 EXEC COBCLG
//*
//* PROCEDURE WITH OVERRIDE
//STEP09 EXEC MYPROC,PARM.STEP1="OVERRIDE"