Mainframe Path Start learning free
Core7 min readLesson 1 of 5

What JCL is for

JCL is not a programming language. It is a work order. It says which program to run, what files to give it, and what to do with those files afterwards. There are no loops and no arithmetic, and that is deliberate.

Three statements carry the whole language

The structure of every job
//JOBNAME JOBOne per job — who is asking, and how it should be handled
//STEPNAME EXECOne per step — which program or procedure to run
//DDNAME DDMany per step — one for each file the program will use

A job contains one or more steps. Each step runs one program. Each step's DD statements connect the names the program uses internally to real datasets in the system. That is the entire mental model.

A complete two-step job
//PAYRUN01 JOB (ACCT01),'MONTHLY PAY',CLASS=A,MSGCLASS=X,
//             NOTIFY=&SYSUID
//* ------ step 1: calculate ------
//STEP010  EXEC PGM=PAYCALC,PARM='RUNDATE=20260930'
//STEPLIB  DD DSN=PROD.PAY.LOADLIB,DISP=SHR
//INFILE   DD DSN=PROD.PAY.MASTER,DISP=SHR
//OUTFILE  DD DSN=PROD.PAY.CALC,DISP=(NEW,CATLG,DELETE),
//            SPACE=(CYL,(50,10),RLSE),
//            DCB=(RECFM=FB,LRECL=200,BLKSIZE=0)
//SYSOUT   DD SYSOUT=*
//* ------ step 2: report, only if step 1 was clean ------
//STEP020  EXEC PGM=PAYRPT,COND=(0,LT,STEP010)
//STEPLIB  DD DSN=PROD.PAY.LOADLIB,DISP=SHR
//INFILE   DD DSN=PROD.PAY.CALC,DISP=(OLD,DELETE,DELETE)
//REPORT   DD SYSOUT=*
//SYSOUT   DD SYSOUT=*

The rules of the page

Why there are no loops

JCL describes *what resources a unit of work needs*, so the system can allocate and serialise them before anything runs. If JCL could loop, the system could not know in advance what a job would touch — and that advance knowledge is what makes safe automatic dataset serialisation possible. Logic belongs inside your program; JCL just wires it up.

Example, line by line

JCLWhat it means
//PAYRUN01 JOB (ACCT01),'MONTHLY PAY',CLASS=A,MSGCLASS=X
JOB statement: the job's name, accounting information, which initiators may run it (CLASS) and where its messages go (MSGCLASS).
//STEP010 EXEC PGM=PAYCALC
EXEC statement: this step runs the program PAYCALC.
//INFILE DD DSN=PROD.PAY.MASTER,DISP=SHR
DD statement: when PAYCALC opens INFILE, it gets PROD.PAY.MASTER, shared for reading.
//SYSOUT DD SYSOUT=*
Program messages go to the spool, in the class given by MSGCLASS.

Try it yourself

TRY IT YOURSELF

Which of the three JCL statement types names the program a step runs?

Show a hint

It is the one with PGM= on it.

Show the solution

EXEC. PGM= names a program; PROC= (or just a name) calls a procedure.

Common mistakes

Trying to put logic in JCL

Conditional execution exists (COND and IF/THEN/ELSE) but it is deliberately limited. If you find yourself fighting it, the logic belongs in a program or in the scheduler.

Forgetting the continuation comma

A parameter list that continues must end the line with a comma. Without it, the next line is read as a new statement and fails confusingly.

Naming a step the same as another step

Duplicate step names make COND and restart references ambiguous. Keep them unique and sequential — STEP010, STEP020.

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
The JOB and EXEC statements →