Mainframe Path Start learning free
Core7 min readLesson 2 of 5

The JOB and EXEC statements

The JOB statement is the header: who is running this, how it should be classified, and what should happen if it goes wrong. The EXEC statement names what to run and can pass it a parameter.

JOB statement parameters worth knowing

ParameterWhat it doesTypical value
Accounting fieldCharges CPU to a department — site-specific and often mandatory(ACCT01)
Programmer nameFree text, second positional parameter'V SAHA'
CLASSWhich initiator pool runs the jobCLASS=A
MSGCLASSWhere system messages goMSGCLASS=X
MSGLEVELHow much JCL and allocation detail is printedMSGLEVEL=(1,1)
NOTIFYSend a completion message to a useridNOTIFY=&SYSUID
REGIONMemory limit for every stepREGION=0M
TIMECPU time limitTIME=(5,00)
TYPRUNSpecial handlingTYPRUN=SCAN or HOLD
RESTARTRestart at a named stepRESTART=STEP030

EXEC: program or procedure

Two ways to write EXEC
* run a load module directly
//STEP010  EXEC PGM=PAYCALC,PARM='RUNDATE=20260930'

* run a catalogued procedure, overriding one of its symbols
//STEP020  EXEC PAYPROC,RUNDT=20260930,REG=64M

* override a DD inside a procedure step
//STEP020.INFILE DD DSN=TEST.PAY.MASTER,DISP=SHR

PARM: passing a value into the program

PARM='...' hands a string to the program at start-up. A COBOL program receives it in its LINKAGE SECTION, preceded by a two-byte length. It is the normal way to pass a run date, a mode flag, or an environment name — and the normal way people accidentally pass a stale date, because the JCL was copied.

COND and the modern replacement

COND decides whether a step is skipped. Its logic is inverted, which is the single most confusing thing in JCL: COND=(4,LT) means *skip this step if 4 is less than the return code*, i.e. skip if RC is above 4.

IF/THEN/ELSE — clearer, and preferred for new work
//STEP010  EXEC PGM=PAYCALC
//SYSOUT   DD SYSOUT=*
//*
//IF (STEP010.RC = 0) THEN
//STEP020  EXEC PGM=PAYRPT
//SYSOUT   DD SYSOUT=*
//ELSE
//STEP900  EXEC PGM=ALERTPGM
//SYSOUT   DD SYSOUT=*
//ENDIF

Common mistakes

Reading COND as 'run if'

It is 'skip if'. This inversion is the source of an enormous number of production surprises.

Leaving a hard-coded date in PARM

Copied JCL with last month's run date produces output that looks right and is wrong. Use a symbol or let the scheduler supply it.

Setting REGION too small

S822 and out-of-storage abends usually trace back to a REGION value copied from a smaller job.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← What JCL is forDD statements: connecting programs to data →