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, Infosys Technologies Ltd
2
ER/CORP/CRS/OS02/003 Version No: 1.0
Pre-requisites
•
MVS Operating system and its subsystem TSO
•
Navigating through ISPF
Copyright © 2005, Infosys Technologies Ltd
3
ER/CORP/CRS/OS02/003 Version No: 1.0
Topics beyond the scope
•
VSAM file-handling
•
User coded COBOL program execution
Copyright © 2005, Infosys Technologies Ltd
4
ER/CORP/CRS/OS02/003 Version No: 1.0
Evaluation Mechanism
Component
Marks
Schedule
Test
100
After Day 3
Copyright © 2005, Infosys Technologies Ltd
5
ER/CORP/CRS/OS02/003 Version No: 1.0
References Title
Author
Publisher
OS/390 and z/OS JCL
Raul Menendez
Murach
MVS JCL
Doug Lowe
Mike Murach & Associates, Inc
MVS/VSAM
Gary D Brown & S.A.M. Smith
SPD
IBM Online manuals
Copyright © 2005, Infosys Technologies Ltd
6
ER/CORP/CRS/OS02/003 Version 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, Infosys Technologies Ltd
7
ER/CORP/CRS/OS02/003 Version No: 1.0
What does JCL stand for ?
J
JOB
L
C
CONTROL
Copyright © 2005, Infosys Technologies Ltd
LANGUAGE
8
ER/CORP/CRS/OS02/003 Version 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, Infosys Technologies Ltd
9
ER/CORP/CRS/OS02/003 Version 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, Infosys 10 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
Various stages of JCL execution
Determine the job
Create the JCL
JES interprets JCL and passes it to MVS
Submit the JOB
System Messages
User Views and Copyright © 2005, Infosys 11 Interprets Technologies Ltd output
MVS does the work
JES collects the output and information about ER/CORP/CRS/OS02/003 the JOB Version No: 1.0
Various stages of JCL execution •
Input
•
Conversion
•
Execution
•
Output
•
Hard copy
•
Purge
Copyright © 2005, Infosys 12 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
INPUT
MVS
INPUT SPOOL
JES
JCL SYSIN
Copyright © 2005, Infosys 13 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
CONVERSION
MVS JES
SPOOL
JCL SYSIN
PROCLIB
PROC
Copyright © 2005, Infosys 14 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
CONVERSION
JOB INTERPRETER - JES2 PAY JCL
INTERPRETER
PAY CONTROL BLOCKS
JES2 ADDRESS SPACE
INITIATOR ADDRESS SPACE
Copyright © 2005, Infosys 15 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
CONVERSION
JOB INTERPRETER - JES3 PAY JCL INTERPRETER
PAY CONTROL BLOCKS
JES3 ADDRESS SPACE
INITIATOR ADDRESS SPACE
Copyright © 2005, Infosys 16 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 17 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
JCL PROCESSING
INPUT STREAM JES2 / JES3
SPOOL JCL
SYSIN SYSOUT
PRINTER JES2 /
INITIATOR1
JES3
Copyright © 2005, Infosys 18 Technologies Ltd
INITIATOR3 INITIATOR2
ER/CORP/CRS/OS02/003 Version No: 1.0
JCL execution JCL INITIATION
JCL SYSIN SYSOUT
STEP INITIATION
ALLOCATION
PROGRAM EXECUTION
STEP TERMINATION
JOB TERMINATION
Copyright © 2005, Infosys 19 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
QUESTIONS ???
• JCL is used to write an application program ? Yes/No •What are the different stages of JCL processing ?
Copyright © 2005, Infosys 20 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
JCL statements •
JOB - Job Identification
•
EXEC - Instruction for Execution
•
DD - Source of data to operate
Copyright © 2005, Infosys 21 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
JOB STATEMENT
ACCT NAME TYPRUN PRTY RESTART REGION PERFORM
CLASS NOTIFY MSGLEVEL MSGCLASS COND USER PASSWORD TIME
Copyright © 2005, Infosys 22 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
IMPORTANT JOB PARAMETERS Positional Parameters
b) Account Information c) 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, Infosys 23 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 24 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 25 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 26 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 27 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 28 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 29 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 30 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 31 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
EXEC STATEMENTS
PGM
COND
PROC
PARM
ACCT
REGION
ADDRSPC
TIME
PERFORM
Copyright © 2005, Infosys 32 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 33 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 34 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 35 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 36 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
COND parameter in detail
Format :
Only code in the exec statement not in job statement
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, Infosys 37 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 38 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 39 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 40 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 41 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 42 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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) STEPNAME PROCSTEP RC // ENDIF STEP1 00 /* STEP3 FLUSH Copyright STEP4 © 2005, Infosys 43 ER/CORP/CRS/OS02/003 00 Technologies Ltd
Version No: 1.0
COMMON keyword PARAMETERS in JOB & EXEC TIME REGION PERFORM COND ADDRSPC ACCT
Copyright © 2005, Infosys 44 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 45 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
JES2 Control Statements $COMMAND JOBPARAM MESSAGE NETACCT NOTIFY
OUTPUT PRIORITY ROUTE SETUP
SIGNOFF SIGNON XEQ XMIT
Copyright © 2005, Infosys 46 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 47 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 48 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 49 Technologies Ltd
ER/CORP/CRS/OS02/003 Version 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, Infosys 50 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0
Thank You! Copyright © 2005, Infosys 51 Technologies Ltd
ER/CORP/CRS/OS02/003 Version No: 1.0