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.
Feel free to 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: Create JCL as per requirement
- Create a JCL with a JOB that includes accounting information as
ACCT1
, a description'DAILY REPORT'
, specifies CLASS asB
, and notifies the current user upon completion.
- Create a JCL where the JOB outputs only JCL statements, JES control statements, and JCL messages by default, while JES, operator, and SMS messages are included only in case of failure. All messages should be routed to destination
A
.
- Create a JOB statement that specifies the programmer name as
JDOE
, omits accounting information, uses CLASSB
, and directs all messages and statements to destinationX
.
- Create a JCL that only scans for syntax errors without actually running the job. The JCL should include an EXEC step named RUNIT that calls the program IEFBR14. How to make this job executable?
- Create a JCL that includes an EXEC statement to run the program MYAPP and pass a parameter named INIT to it.
- Create a JCL that notifies a different user when the job completes.
Write your own simple JCL snippet for each case and explain them:
- 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 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)
Fix Invalid Job 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
//9DAILY JOB (123),'DAILY',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
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)
Exercise : Identify true or false for the below statements.
- 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.
Exercise - Naming Conventions
- For the following JOB names, identify which are valid and which are invalid according to JCL rules:
@BACKUP
,123RUN
,MYSYSTEM
,#SORT01
,$DATA99
,BIG-JOB
.
- Identify the invalid step name and explain why:
//RUN01 EXEC PGM=IEFBR14
//01STEP EXEC PGM=IEFBR14
Evaluation Time Parameter
- You have a JOB with
1 minute
time limit and two steps: STEP1 with45 seconds
, STEP2 with40 seconds
. Both step takes around 35 seconds each to complete. Will both steps complete successfully? Why or why not?
- Given a JOB with
TIME=(0,12)
, 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.