Introduction
This exercise set helps you practice the basics of the JOB and EXEC statements in JCL, focusing on building simple JCLs, understanding the TIME parameter behavior, and applying the correct rules for naming JOBs and EXEC steps. The goal is to build comfort with common mistakes and tricky spots in real-world usage.
For reference, see:
Refer to IBM Docs - Reusable JCL to get JCLs for common usages.
Exercise: Create JCL as per requirement
- Create a JCL with a JOB having accounting info
(ACCT1)
, description'DAILY REPORT'
,CLASS=B
,NOTIFY=&SYSUID
, and an EXEC runningIEFBR14
. - Create a JCL where the JOB uses
MSGLEVEL=(2,0)
,MSGCLASS=A
, and the EXEC step is namedSTEP001
running programSORT
. - Create a JOB statement for programmer
JDOE
with no accounting info but specifyCLASS=A
andMSGCLASS=X
. - Create a JCL with a JOB using
TYPRUN=SCAN
and an EXEC step namedRUNIT
callingIEFBR14
. Will this job execute? - Create an EXEC statement that runs program
MYAPP
and passes a parameterINIT
. - Create a JCL to notify Another User.
Write your own simple JCL snippet for each case:
- A JOB statement using at least one positional and two keyword parameters.
- An EXEC statement combining a positional and a keyword parameter.
Exercise: Fix and execute the JCL
Below are 2 samples of some invalid/incomplete JCL. Execute them and make sure both the dataset are create and Job completes with Return code 2.
//<YOUR ID>D JOB ,TYPRUN=SCAN,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.OUTPUT4,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//<YOUR ID>E JOB ,TYPRUN=HOLD,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.OUTPUT5,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
Exercise: Get me the Answer
- You have a JOB with
1 minute
time limit and two steps: STEP1 with45 seconds
, STEP2 with40 seconds
. Both step takes around 35 mins each to complete. Will both steps complete successfully? Why or why not? - Given a JOB with
TIME=(0,10)
, STEP1 withTIME=(0,5)
takes 4 second to complete, and STEP2 withTIME=(0,8)
takes 8 seconds to complete, explain which limit will cause an abend and why. - Create a JCL where the JOB does not code TIME, STEP1 has
TIME=(0,20)
and STEP2 hasTIME=(0,30)
. Explain which TIME limit applies where and what happens if STEP2 takes 40 seconds. - For the following JOB names, identify which are valid and which are invalid according to JCL rules:
@BACKUP
,123RUN
,MYSYSTEM
,#SORT01
,$DATA99
,BIG-JOB
. - Look at this JCL and identify the invalid step name and explain why:
//RUN01 EXEC PGM=IEFBR14
and//01STEP EXEC PGM=IEFBR14
. - Fix this JOB statement to make it valid:
//9DAILY JOB (123),'DAILY',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
. - State True or False:
- Step names can start with a number.
- Step names must be unique within a job
- JOB names can include special characters other than
$
,#
, or@
. Explain if False.
Fix Invalid Job and EXEC Statement
Fix the following Invalid Job Statements
//MYJOB JOB ,'TEST JOB',MSGCLASS=A,MSGLEVEL=(1,1),TIME
//MY JOB JOB (ACCT),'SAMPLE'
//*MYJOB JOB (ACCT),'COMMENTED JOB'
//MYJOB JOB (ACCT),'TEST',NOTIFY=
//1234JOB JOB (ACCT),'TEST'
//MYJOB JOB (ACCT),'TEST',REGION=MB
Fix the following Invalid EXEC Statements
//STEP01 EXEC
//STEP02 EXEC PGM=
//STEP03 EXEC PROC=MYPROC,PGM=IEFBR14
//STEP04 EXEC PGM=MYPROG,CLASS=A
// STEP10 EXEC PGM=MYPGM,TYME=(0,5)