JCL
Day 1
Course Plan
Day 1 : Introduction to JCL, JOB & EXEC statement , JES
commands
Day 2 : DD statements, JCL Procedures & IBM Utilities
Day 3 : Introduction to VSAM, GDG & SMS
Copyright © 2005, 2 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Pre-requisites
• MVS Operating system and its subsystem TSO
• Navigating through ISPF
Copyright © 2005, 3 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Topics beyond the scope
• VSAM file-handling
• User coded COBOL program execution
Copyright © 2005, 4 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Evaluation Mechanism
Component Marks Schedule
Test 100 After Day 3
Copyright © 2005, 5 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
References
Title Author Publisher
OS/390 and z/OS Raul Menendez Murach
JCL
MVS JCL Doug Lowe Mike Murach &
Associates, Inc
MVS/VSAM Gary D Brown & SPD
S.A.M. Smith
IBM Online
manuals
Copyright © 2005, 6 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Agenda for Day 1
Introduction to JCL
What is JCL
Why we need JCL
How we can use it
Sequence & priority of execution
Job statement
Syntax
Parameters
Exec statement
Syntax
Parameters
COND parameter
JES commands, JCL errors & Abends
Copyright © 2005, 7 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
What does JCL stand for ?
J C L
JOB CONTROL LANGUAGE
Copyright © 2005, 8 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
What is JCL then?
• Not a Procedural or OO Language
• JOB CONTROL LANGUAGE
• Interface between Programs & MVS OS.
• Why JCL?
• Sample JCL code
Copyright © 2005, 9 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Sample JCL
//UseridJ JOB ,,NOTIFY=&SYSUID,CLASS=D,
// MSGLEVEL=(1,1),MSGCLASS=X
//* SAMPLE JCL
//STEP1 EXEC PGM=SEQPROC
//STEPLIB DD DSN=OPERN.CICS3.LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=YourMainframeId.JCL.DAY2.FILE1,DISP=SHR
//OUTFILE DD DSN=YourMainframeId.JCL.DAY2.FILE2,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(10,5),RLSE),
// DCB=(LRECL=80,BLKSIZE=8000,RECFM=FB)
Copyright © 2005, 10 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Various stages of JCL execution
JES
interprets
Determine Create Submit JCL and
the the the passes it
job JCL JOB to
MVS
System MVS does
Messages the work
JES
collects
the output
User and information
Views and about
Copyright © 2005,
Interprets 11 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: the
1.0 JOB
output
Various stages of JCL execution
• Input
• Conversion
• Execution
• Output
• Hard copy
• Purge
Copyright © 2005, 12 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
INPUT
MVS INPUT
SPOOL
JES JCL
SYSIN
Copyright © 2005, 13 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
CONVERSION
SPOOL
MVS
JCL
JES SYSIN
PROCLIB
PROC
Copyright © 2005, 14 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
CONVERSION
JOB INTERPRETER - JES2
PAY INTERPRETER
JCL
PAY
CONTROL
BLOCKS
JES2 INITIATOR
ADDRESS ADDRESS
SPACE SPACE
Copyright © 2005, 15 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
CONVERSION
JOB INTERPRETER - JES3
PAY
JCL
INTERPRETER
PAY
CONTROL
BLOCKS
JES3 INITIATOR
ADDRESS ADDRESS
SPACE SPACE
Copyright © 2005, 16 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
EXECUTION, OUTPUT, HARDCOPY and PURGE
• Execution:
– JES selects a job for execution , based upon job CLASS and
job selection PRTY
Ex: //ER5077 JOB ,,PRTY=8,CLASS=A
– Allocation of datasets
– SYSIN and SYSOUT
• OUTPUT, HARDCOPY and PURGE
Copyright © 2005, 17 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
JCL PROCESSING
INPUT
STREAM JES2 / SPOOL
JES3
JCL
SYSIN
SYSOUT
PRINTER JES2 / INITIATOR1 INITIATOR3
JES3 INITIATOR2
Copyright © 2005, 18 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
JCL execution
JCL INITIATION
STEP INITIATION
JCL
SYSIN ALLOCATION
SYSOUT PROGRAM EXECUTION
STEP TERMINATION
JOB TERMINATION
Copyright © 2005, 19 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
QUESTIONS ???
• JCL is used to write an application program ?
Yes/No
•What are the different stages of JCL processing ?
Copyright © 2005, 20 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
JCL statements
• JOB - Job Identification
• EXEC - Instruction for Execution
• DD - Source of data to operate
Copyright © 2005, 21 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
JOB STATEMENT
ACCT CLASS
NAME NOTIFY
MSGLEVEL
TYPRUN MSGCLASS
PRTY COND
RESTART USER
REGION PASSWORD
PERFORM TIME
Copyright © 2005, 22 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT JOB PARAMETERS
Positional Parameters
a) Account Information
b) Name
EX: //ER5077J JOB A123,NAME1
All these parameters are optional as far as JCL is concerned, they
are probably required by your installation.
Copyright © 2005, 23 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT JOB PARAMETERS
Keyword Parameters
CLASS
EX: //ER5077J JOB ,,CLASS=A
• CLASS specifies the job class that is the nature of the job.
Installation will specify which of the 36 possible classes to use
which is from A to Z and 0 to 9 .
• Installation establishes a default class that is in effect if CLASS
is omitted.
Copyright © 2005, 24 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
A typical JOB Class assignment
Class Characteristics
A Execute within 15 min of submission
B Execute within 30 min of submission
C Execute within 60 min of submission
D Execute Overnight
H Will be held until released by operator
L Execute within 15 min of submission
T Requires Tape Processing
Copyright © 2005, 25 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT JOB PARAMETERS
Keyword Parameters
MSGCLASS
EX: //ER5077J JOB ,,MSGCLASS=A
• MSGCLASS specifies the job scheduler message output class.
• Job scheduler messages include all messages not printed by the
job steps being executed but the JCL messages and system
messages
• Installation establishes a default class that is in effect if
MSGCLASS is omitted.
Copyright © 2005, 26 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT JOB PARAMETERS
Keyword Parameters
MSGLEVEL
EX: //ER5077J JOB ,,MSGLEVEL=(1,1)
• MSGLEVEL(statements,messages) specifies the printing of JCL
statements and allocation messages.
• EX: MSGLEVEL(0,1) will print only JOB statement, and all the
allocation, JES, SMS and operator messages
• By default it is MSGLEVEL(1,1)
Copyright © 2005, 27 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT JOB PARAMETERS
Keyword Parameters
NOTIFY
//ER5077J JOB ,,NOTIFY=&SYSUID
//ER5077J JOB ,,NOTIFY=ER5077
• Requests the system sends a message to the TSO user id
specified when the job completes processing
Copyright © 2005, 28 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT JOB PARAMETERS
Keyword Parameters
TYPRUN
EX: //ER5077J JOB ,,TYPRUN=SCAN
• TYPRUN checks the JCL and holds the job in the input queue.
• TYPRUN = SCAN checks the JCL for syntax errors and suppresses execution
of the job
• TYPRUN = HOLD holds the JCL in the input queue for later execution.It is held
until the operator releases it.
• TYPRUN = JCLHOLD(JES2 only) similar to HOLD but the difference is it is
checked while it is not with the HOLD option.
• TYPRUN = COPY(JES2 only) lists or duplicates the lines placed in the JOB
statement to the class assigned in the MSGCLASS parameter and suppresses
execution.
Copyright © 2005, 29 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
SOME OTHER Keyword JOB PARAMETERS
PRTY=Priority : is related to the CLASS parameter. It assigns
priority to jobs which belong to the same class.priority numbers
range from (0-14) or (0-15) depending on installations.
TIME=(min,sec) : signifies how much CPU time the JOB can take to
run.
RESTART=STEPNAME :Forces the JOB execution to start from a
particular STEP.
Copyright © 2005, 30 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
SOME OTHER keyword JOB PARAMETERS
• ADDRSPC=REAL : It is used to specify whether the program is
to use REAL or VIRTual ADDRess SPaCe. Default is Virtual. If
Real is coded then the REGION parameter is also to be coded.
• REGION=96K :To override the default amount of workspace
assigned for the job.
• COND=(4,LT) :Permits the execution of a steps to depend on the
return code from the previous steps.
Copyright © 2005, 31 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
EXEC STATEMENTS
PGM COND
PROC PARM
ACCT REGION
ADDRSPC TIME
PERFORM
Copyright © 2005, 32 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT EXEC PARAMETERS
positional parameters
PGM & PROC
EX: //STEP1 EXEC PGM=IEFBR14
EX: //STEP1 EXEC PROC=MYPROC
The PGM parameter identifies the name of the program that is to be
executed.
The PROC parameter identifies the name of the procedure that is to
be called.
Copyright © 2005, 33 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT EXEC PARAMETERS
keyword parameters
PARM
EX: //STEP1 EXEC PGM=IEBUPDT,PARM=‘LET,MAP,XREF’
The PARM parameter is used to supply information to a program as
it executes.
Copyright © 2005, 34 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT EXEC PARAMETERS
keyword parameters
ADDRSPC
EX: //STEP1 EXEC PGM=IEBUPDT,ADDRSPC=VIRT
The ADDRSPC parameter is to indicate to the system that the job
step is to use either VIRT (virtual) or REAL (real) storage.
By default it is virtual.
Copyright © 2005, 35 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT EXEC PARAMETERS
keyword parameters
COND
EX: //STEP3 EXEC PGM=IEBUPDT,COND=(8,LE,STEP1)
• The COND Permits the execution of steps to depend
on the return code from the previous steps.
• The question should be is 8 less than the RC code of STEP1.
If Yes then Bypass STEP3
If No Execute STEP3
• The COND parameter is also a JOB parameter.
Copyright © 2005, 36 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANT EXEC PARAMETERS
keyword parameters
COND
•=
Copyright © 2005, 37 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
COND parameter in detail
Only code in the exec statement
not in job statement
Format :
COND=( 0/4/6/8/12/16 , GT/GE/LT/LE/EQ/NE , step name , EVEN/ONLY )
RC comparison Condition
code
(0 - 4095)
EVEN : step will be executed even if previous steps
terminate abnormally
ONLY : step will be executed only if previous steps
terminate abnormally.
Copyright © 2005, 38 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
COND parameter examples
(in JOB statement)
//ER5077J JOB ,,COND=(4,LT)
//STEP1 EXEC PGM=IEFBR14
//STEP2 EXEC PGM=IFBR14
//STEP3 EXEC PGM=IEFBR14
• STEP1 executes with RC = 0
• STEP2 executes with
RC *S806 that is it is greater than 4
• Job terminates
Copyright © 2005, 39 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
COND parameter examples
(in EXEC statement)
//ER5077J JOB ,,CLASS=A
//STEP1 EXEC PGM=IEFBR14
//STEP2 EXEC PGM=IEFBR14,COND=(0,EQ,STEP1)
• STEP1 executes with RC = 0
• STEP2 does not execute
Copyright © 2005, 40 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
COND parameter examples
(in EXEC statement)
// ER5077J JOB ,,CLASS=A
//STEP1 EXEC PGM=IEFBR14
//STEP2 EXEC PGM=IEFBR14,COND=ONLY
• STEP1 executes with RC = 0
• STEP2 does not execute
//ER5077J JOB ,,CLASS=A
//STEP1 EXEC PGM=IFBR14
//STEP2 EXEC PGM=IEFBR14
//STEP3 EXEC PGM=IEFBR14,COND=ONLY
• STEP1 abends with RC = *S806
• STEP2 does not execute ( if a single step abends all other steps
are bypassed if no COND statement is there )
• STEP3 executes with RC = 0
Copyright © 2005, 41 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
COND parameter examples
(in EXEC statement)
//ER5077J JOB ,,CLASS=A
//STEP1 EXEC PGM=IEFBR14
//STEP2 EXEC PGM=IEFBR14,COND=EVEN
• STEP1 executes with RC = 0
• STEP2 executes with RC = 0
//ER5077J JOB ,,CLASS=A
//STEP1 EXEC PGM=IFBR14
//STEP2 EXEC PGM=IEFBR14
//STEP3 EXEC PGM=IEFBR14,COND=EVEN
• STEP1 abends with RC = *S806
• STEP2 does not execute ( if a single step abends all other steps
are bypassed if no COND statement is there )
• STEP3 executes with RC = 0
Copyright © 2005, 42 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IMPORTANTEXECPARAMETERS
keyword parameters
(IF/THEN/ELSE/ENDIF)
EX: // IF STEPA.RC GE 4 THEN
//jcl statements
// ELSE
//jcl statements
// ENDIF
• The IF/THEN/ELSE/ENDIF statement construct
provides a simple means of selectively executing job steps.
• It is available in Release 4 or later , of MVS/ESA and
eliminates the need to struggle with the COND parameter.
Copyright © 2005, 43 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
IF/THEN/ELSE/ENDIF parameter
examples
//ER5077A JOB 2933100P,ABC,MSGCLASS=A,CLASS=A
//STEP1 EXEC PGM=IEFBR14
// IF STEP1.RC GT 0 THEN
//STEP3 EXEC PGM=IEFBR14
//DD1 DD DSN=ER5077.TRUE.PS,DISP=(NEW,CATLG),
// VOL=SER=INUSR2,
// SPACE=(TRK,(1,1)),
// DCB=(LRECL=80,BLKSIZE=800,RECFM=FB)
// ELSE
//STEP4 EXEC PGM=IEFBR14
//DD2 DD DSN=ER5077.FALSE.PS,DISP=(NEW,CATLG),
// VOL=SER=INUSR2,
// SPACE=(TRK,(1,1)),
// DCB=(LRECL=80,BLKSIZE=800,RECFM=FB)
// ENDIF STEPNAME PROCSTEP RC
/* STEP1 00
STEP3 FLUSH
STEP4
Copyright © 2005, 44 ER/CORP/CRS/ 00
Infosys Technologies Ltd OS02/003Version No: 1.0
COMMON keyword PARAMETERS
in JOB & EXEC
TIME
REGION
PERFORM
COND
ADDRSPC
ACCT
Copyright © 2005, 45 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
JOB ENTRY SUBSYSTEM
JES2 / JES3
JES2 or JES3 statements can be
included to communicate with JES concerning...
• INPUT
• OUTPUT
• PROCESSING
Copyright © 2005, 46 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
JES2 Control Statements
$COMMAND OUTPUT SIGNOFF
JOBPARAM PRIORITY SIGNON
MESSAGE ROUTE XEQ
NETACCT SETUP XMIT
NOTIFY
Copyright © 2005, 47 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
JES2 Control Statements
NOTIFY - direct job’s notification messages to a user.
PRIORITY or PRTY -Assign a selection priority for your job. Within a
job class, a job with a higher priority is selected for execution
sooner.
• JES2 Control statements are preceded
with /* in col1 & col2.
Copyright © 2005, 48 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Errors
•JCL syntax errors.
JOB will not be submitted
• JCL allocation errors.
JES2-subsequent steps will not get executed.
JES3-detects errors in the beginning.
Copyright © 2005, 49 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Abend Failures
An ABEND failure occurs under the following conditions:
A program while executing, attempts to perform an instruction or
operation which the system recognizes as being impossible or
unacceptable.
Copyright © 2005, 50 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Causes of Abend Failures
Logic error
Resource unavailability
Exceeding limits (Time or Space on DASD)
Hardware Malfunction
User ABENDS
Operator intervention
Operating System failure
Copyright © 2005, 51 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0
Thank You!
Copyright © 2005, 52 ER/CORP/CRS/
Infosys Technologies Ltd OS02/003Version No: 1.0