Skip to main content

Introduction

Every JCL statement is more than just text—it's a carefully positioned set of fields that your mainframe parser relies on to understand what you mean.

From the mandatory // in columns 1-2 to the precise breakpoints for names, operations, and parameters, even a single-character misplacement can turn a valid job into an abend or silently alter its behavior.

Mastering the layout—knowing where identifiers belong, how to continue long statements correctly, and when positional values give way to flexible keywords—is essential for reliable, maintainable batch processing.

In this exercise, you'll be working with valid/invalid JCL templates. Your task is to properly apply the rules wherever not applied and explain where applied.

You can also refer to How to create and Submit JCL.

This exercise refer to setup for testing some scenarios. Make sure to replace <Your ID> with your training ID and <YOUR REXX EXEC> with the REXX EXEC dataset created.

Exercise: Find and fix everything in JCL

Task: Identify and fix at least one error in each of the JCL templates provided. Be mindful of the specific issues each template might contain and adjust accordingly.Examine the job log to identify why the step failed and fix the error in the JCL accordingly.

//<YOUR ID>A  JOB ,NOTIFY=&SYSU1D                             
//COMBINE EXEC PGM=IRXJCL,PARM='RETRC 2'
//SYSEXEC DD DSN=<YOUR REXX EXEC>,DISP=SHR
//SYSTSIN DD DUMMY
//SYSTSPRT DD DSN=&SYSU1D..EXERCISE.OUTPUT1,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

//<YOUR ID>B  JOB ,MSGLEVEL=0,1                             
//COMBINE EXEC PGM=IRXJCL,PARM='RETRC 2'
//SYSEXEC DD DSN=<YOUR REXX EXEC>,DISP=SHR
//SYSTSIN DD DUMMY
//SYSTSPRT DD DSN=&SYSUID..EXERCISE.OUTPUT2,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

//<YOUR ID>C  JOB ,NOTIFY=&SYSUID                             
//COMBINE EXEC PARM='RETRC 2',PGM=IRXJCL
//SYSEXEC DD DSN=<YOUR REXX EXEC>,DISP=SHR
//SYSTSIN DD DUMMY
//SYSTSPRT DD DSN=&SYSUID..EXERCISE.OUTPUT3,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

//<YOUR ID>D  JOB ,NOTIFY=&SYSUID
//OUTPUT1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
// DD1 DD DSN=&SYSUID..EXERCISE.OUTPUT6,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

//<YOUR ID>E  JOB ,NOTIFY=&SYSUID
//OUTPUT1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=&SYSUID..EXERCISE,OUTPUT8,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

//<YOUR ID>F  JOB ,NOTIFY=&SYSUID
//OUTPUT1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//1DD DD DSN=&SYSUID..EXERCISE.OUTPUT9,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

//<YOUR ID>G  JOB ,NOTIFY=&SYSUID                             
//COMBINE EXEC PGM=IRXJCL,PARM=RETRC
// 2
//SYSEXEC DD DSN=<YOUR REXX EXEC>,DISP=SHR
//SYSTSIN DD DUMMY
//SYSTSPRT DD DSN=&SYSUID..EXERCISE.OUTPUTA,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

Exercise: Identify the Mistake

Review the following JCL snippets. Identify if there's a problem with positional and keyword parameter usage. If there is an error, explain briefly what is wrong.

  • //JOBX JOB (123),'MYNAME',CLASS=A,MSGCLASS=X
  • //STEP1 EXEC PARM='RUN1',PGM=MYPROG
  • //INPUT DD DISP=OLD,DSN=MY.FILE.DATA

Exercise: Create JCL as per requirement

  • Add a comment line before a JCL step to explain its purpose. Ensure the comment line starts is ignored by the system.
  • Write a JCL statement that exceeds 71 characters and correctly continues it on the next line.
  • Write a JCL that includes a null statement to separate two job steps in the execution sequence, ensuring that the second step is still processed even if the first step fails.