Learn Jcl-scripting - 10 Code Examples & CST Typing Practice Test
JCL (Job Control Language) is a scripting language used on IBM mainframes to instruct the system on how to execute batch jobs, manage resources, and run programs. It is essential for scheduling, running, and controlling batch workloads in z/OS environments.
View all 10 Jcl-scripting code examples →
Learn JCL-SCRIPTING with Real Code Examples
Updated Nov 27, 2025
Code Sample Descriptions
Simple JCL Job to Run a COBOL Program
//JOB001 JOB (ACCT),'RUN COBOL',CLASS=A,MSGCLASS=X
//STEP1 EXEC PGM=MYCOBOL
//INFILE DD DSN=MY.INPUT.FILE,DISP=SHR
//OUTFILE DD DSN=MY.OUTPUT.FILE,DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(10,1))
//SYSOUT DD SYSOUT=*
Submit a COBOL program with input and output datasets.
JCL Conditional Job Step
//STEP2 EXEC PGM=ANOTHERPGM,COND=(0,NE,STEP1)
//SYSOUT DD SYSOUT=*
Execute STEP2 only if STEP1 completes successfully.
JCL Allocate Temporary Dataset
//TEMPDATA DD DSN=&&TEMP,DISP=(NEW,PASS),UNIT=SYSDA,SPACE=(CYL,(5,1)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
Define a temporary dataset for program processing.
JCL Execute Multiple Steps
//JOB002 JOB (ACCT),'MULTI STEP',CLASS=A,MSGCLASS=X
//STEP1 EXEC PGM=PROG1
//SYSOUT DD SYSOUT=*
//STEP2 EXEC PGM=PROG2
//SYSOUT DD SYSOUT=*
Run multiple steps in a single job.
JCL Pass Parameters to Program
//JOB003 JOB (ACCT),'PARAM TEST',CLASS=A,MSGCLASS=X
//STEP1 EXEC PGM=MYPROG,PARM='INPUT1 OUTPUT1'
//SYSOUT DD SYSOUT=*
Pass command-line parameters to a program using PARM keyword.
JCL Include Cataloged Procedure
//JOB004 JOB (ACCT),'CAT PROC',CLASS=A,MSGCLASS=X
//STEP1 EXEC PROC=MYPROC,PARM='DATA1 DATA2'
//SYSOUT DD SYSOUT=*
Use a pre-defined cataloged procedure in your job.
JCL Execute a DB2 Program
//JOB005 JOB (ACCT),'DB2 JOB',CLASS=A,MSGCLASS=X
//STEP1 EXEC PGM=MYDB2PGM,REGION=4M
//DB2OUT DD SYSOUT=*
//SYSIN DD DUMMY
Run a DB2 program with DB2 precompiler environment.
JCL Handle Job Output to Different SYSOUT Classes
//JOB006 JOB (ACCT),'SYSOUT TEST',CLASS=A,MSGCLASS=X
//STEP1 EXEC PGM=PROG1
//SYSOUT DD SYSOUT=A
//STEP2 EXEC PGM=PROG2
//SYSOUT DD SYSOUT=B
Direct output of different steps to different SYSOUT classes.
JCL Re-run Job Step on Failure
//JOB007 JOB (ACCT),'RETRY STEP',CLASS=A,MSGCLASS=X
//STEP1 EXEC PGM=PROG1,COND=(4,LT)
//SYSOUT DD SYSOUT=*
Automatically re-run a step if it fails using RESTART and COND.
JCL Submit Another Job from Job
//JOB008 JOB (ACCT),'SUBMIT JOB',CLASS=A,MSGCLASS=X
//STEP1 EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
submit 'USER.TEST.JOB'
END
Use the SUBMIT statement to trigger another job from this job.
Frequently Asked Questions about Jcl-scripting
What is Jcl-scripting?
JCL (Job Control Language) is a scripting language used on IBM mainframes to instruct the system on how to execute batch jobs, manage resources, and run programs. It is essential for scheduling, running, and controlling batch workloads in z/OS environments.
What are the primary use cases for Jcl-scripting?
Submitting and scheduling batch jobs on mainframes. Allocating datasets and managing files. Running COBOL, PL/I, or assembler programs. Handling conditional job execution and dependencies. Automating repetitive enterprise operations
What are the strengths of Jcl-scripting?
Direct control over mainframe batch execution. Stable and mature for enterprise batch workloads. Handles complex job dependencies. Optimized for IBM z/OS systems. Extensive support for dataset and printer management
What are the limitations of Jcl-scripting?
Specific to IBM mainframes and z/OS. Steep learning curve for beginners. Verbose syntax with strict formatting requirements. Limited portability outside mainframes. Debugging can be complex without proper logs or tools
How can I practice Jcl-scripting typing speed?
CodeSpeedTest offers 10+ real Jcl-scripting code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.