JCL JOB, EXEC, and DD Statements Explained for Beginners
Understand the three core JCL statements used in almost every mainframe batch job: JOB, EXEC, and DD.
JCL, or Job Control Language, tells z/OS how to run a batch job. If COBOL is the business logic, JCL is the runtime instruction sheet. It says what program to run, what files to use, where output should go, and how the job should behave.
The three core JCL statements
Most beginner JCL examples are built from three statements:
JOBidentifies the job.EXECidentifies the program or procedure to run.DDidentifies datasets, files, and system resources.
Example:
//MYJOB JOB (ACCT),'BALA',CLASS=A,MSGCLASS=X
//STEP01 EXEC PGM=MYCOBOL
//INFILE DD DSN=DBALA.INPUT.FILE,DISP=SHR
//OUTFILE DD DSN=DBALA.OUTPUT.FILE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(1,1)),UNIT=SYSDA
//SYSOUT DD SYSOUT=*
JOB statement
The JOB statement starts the job and provides scheduling/accounting information. It normally includes account details, job name, class, notification, region, or message class depending on site standards.
The job name appears after //. For example:
//MYJOB JOB ...
MYJOB is the job name shown in spool tools such as SDSF.
EXEC statement
The EXEC statement starts a job step. A single job can have one or many steps. Each step runs a program or a cataloged procedure.
Examples:
//STEP01 EXEC PGM=IDCAMS
//STEP02 EXEC PGM=SORT
//STEP03 EXEC PROC=MYPROC
If a job fails, the failing step is usually the first place to investigate.
DD statement
The DD statement defines datasets or runtime files needed by a step. COBOL programs use DD names to connect logical files to actual datasets.
Example:
//INFILE DD DSN=DBALA.CUSTOMER.INPUT,DISP=SHR
If the COBOL program has ASSIGN TO INFILE, this DD statement supplies the dataset.
DISP basics
DISP tells z/OS what to do with the dataset.
Common values:
DISP=SHRmeans read/share an existing dataset.DISP=OLDmeans exclusive use of an existing dataset.DISP=(NEW,CATLG,DELETE)means create a new dataset, catalog on success, delete on failure.
Conclusion
JCL becomes easier when you see it as runtime wiring. JOB starts the job, EXEC starts each step, and DD connects programs to datasets and system services. Mastering these three statements gives a strong base for batch development and support.