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
| Parameter | What it does | Typical value |
|---|---|---|
| Accounting field | Charges CPU to a department — site-specific and often mandatory | (ACCT01) |
| Programmer name | Free text, second positional parameter | 'V SAHA' |
| CLASS | Which initiator pool runs the job | CLASS=A |
| MSGCLASS | Where system messages go | MSGCLASS=X |
| MSGLEVEL | How much JCL and allocation detail is printed | MSGLEVEL=(1,1) |
| NOTIFY | Send a completion message to a userid | NOTIFY=&SYSUID |
| REGION | Memory limit for every step | REGION=0M |
| TIME | CPU time limit | TIME=(5,00) |
| TYPRUN | Special handling | TYPRUN=SCAN or HOLD |
| RESTART | Restart at a named step | RESTART=STEP030 |
EXEC: program or procedure
* 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.
//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
It is 'skip if'. This inversion is the source of an enormous number of production surprises.
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.
S822 and out-of-storage abends usually trace back to a REGION value copied from a smaller job.
What you will see at work
- Your site standard will dictate the accounting field and job classes. Getting them wrong means the job is rejected before it runs — an easy fix.
- TYPRUN=HOLD lets you submit a job that waits until someone releases it. Useful when you want it queued but not yet running.
- RESTART= is how a failed multi-step job is resumed after a fix, rather than rerunning from the top. Know your application's restart rules before using it.
Key terms
Check your understanding.
Take this lesson's quiz and save your progress. Free.