jcl day 2. 2 copyright © 2005, infosys technologies ltd er/corp/crs/os02/003 version no: 1.0 agenda...
TRANSCRIPT
JCL
Day 2
2Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Agenda for Day 2
DD statementSyntaxParameters
ProceduresTypesSymbolic ParametersExamples
IBM Utility programsDefinition and useExamples
3Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
DD STATEMENTS
ddname DD *
VOL DATA
DCB SYSOUT
DSN DUMMY
UNIT DLM
DISP SYSUDUMP
SYSMDUMP SYSABEND
REFERBACK JOBLIB
STEPLIB
4Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
DSN
• The name of the data set
Simple Name : 1 to 8 chars
Qualified Name : separated by periods each name 1 to 8 chars total 44 characters including periods
Temporary data sets : &&TEMP or do not mention DSN parameter
Refer back : DSN=*.STEP1.DD1
5Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
DISP
NEW , CATLG , DELETE
OLD , KEEP , KEEP
DISP= SHR , UNCATLG , CATLG
MOD , DELETE , UNCATLG
PASS ,
DISP=(status,normal-disposition,abnormal-disposition)
6Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
DCB
LRECL=n (VALUE IN BYTES)
RECFM=(F/FB/V/VB/U)
BLKSIZE= multiple of LRECL
DSORG=(PS/PO/DA)
7Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
SPACE
SPACE=(space units,(primary,secondary,dir),RLSE)
space unit - TRK(tracks)/CYL(cylinders)/BLOCKSIZE in bytes
EX:
SPACE=(TRK,(100,200))
SPACE=(TRK,(10,5))
- allocate 10 tracks primarily and if required as secondary allocation 5 tracks
8Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
UNIT
Hardware address
Type
Group
// UNIT=0320 OR// UNIT=3390 OR // UNIT=SYSDA
OR// UNIT=DISK
To use the same unit that has been used by prior DD statement// UNIT=AFF=ddname
9Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
VOL
It is used to specify a disk volume or specific tapes.
// VOL=SER=INUSR2,UNIT=SYSDA
To referback a volume used by some prior DD statement use:
// VOL=REF=ddname
10Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
SYSOUT
// DDNAME DD SYSOUT=CLASS
SYSOUT is used to route output to a device.
// DDNAME DD SYSOUT=A
If you want to send the output to the same device
described by MSGCLASS of the job use:
// DDNAME DD SYSOUT=*
11Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
JOBLIB STATEMENTS
EX
//ER5077A JOB ,,CLASS=A
//JOBLIB DD DSN=OPERN.CICS3.LOADLIB,
The JOBLIB statement specifies the library (PDS) where the program is residing. It is placed after the JOB statement and is effective for every JOB steps.
// DISP = (what should be the disposition)
// DISP = SHR
//STEP1 EXEC PGM=INHOUSE
12Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
STEPLIB STATEMENTS
EX. //STEP1 EXEC PGM=INHOUSE //STEPLIB DD DSN=OPERN.CICS3.LOADLIB,
The STEPLIB statement defines the library where the program is residing. It is placed after the EXEC statement and is effective for that particular step and overrides any JOBLIB statement.
// DISP = (what should be the disposition)
// DISP = SHR
13Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
The first JCL to create a PS.
//ER5077J JOB 1234,ABC,CLASS=A,// MSGCLASS=(1,1) TO CREATE PS
//STEP1 EXEC PGM=IEFBR14
//PS1 DD DSN=ER5077.OUTPUT.PSFILE,// UNIT=SYSDA,// VOL=SER=INUSR2,// DCB=(LRECL=80,RECFM=FB,BLKSIZE=800),// SPACE=(TRK,(1,1)),DISP=(NEW,CATLG)
14Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Review Questions
The positional parameters for an EXEC statement are PGM & PROC
COND Permits the execution of steps to depend on the return code from the
Previous Steps
JOBLIB represents the collection of jobs ? False. Represents library for USER programs
JCL has JOBLIB. Step1 has STEPLIB statement. For Step2 the program would be searched in JOBLIB/STEPLIB library?
JOBLIB. STEPLIB is valid for only Step1
15Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Review Questions ….
For the following JCL will Step 2 get executed? //ER5077J JOB ,,NOTIFY=&SYSUID, COND=(4,LT) //STEP1 EXEC PGM=IEFBR14 //STEP2 EXEC PGM=IEFBR14,COND=(0,NE,STEP1)
Yes. Step2 would be executed.
If COND parameter is mentioned in JOB & EXEC statement then what happens?
COND mentioned in the JOB statement is evaluated first & then the COND mentioned in the EXEC statement
16Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
PROCEDURES
It is a prepacked JCL A JCL needed by many different users
A JCL executed on a repetitive basis A JCL often repeated within the execution of a single job
17Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
TYPE OF PROCEDURES
In-stream procedures Coded in the executing job Max of 15 per JOB
Catalogued Procedure Member of a PDS (procedure library) Max 255 steps
18Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Invoking a Procedure
// EXEC procname
// EXEC PROC=procname
EX:
//name1 EXEC MYPROC
//name1 EXEC PROC=MYPROC
19Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
PROCEDURES must not contain :
1) JOB statement
2) JOBLIB DD statement 3) DD * , DD DATA - In-stream data 4) /* delimiter statement 5) // Null statement 6) JES statements 7) PEND statement (for cataloged procedures)
20Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
In-stream procedure
1. It must begin with a PROC statement and end with a PEND statement
2. It should be coded before the first EXEC statement invoking the instream procedure
//ER5077J JOB ,,CLASS=A //PROC1 PROC //STEP2 EXEC PGM=IEFBR14 //DD1 DD DSN=&&TEMP,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),// DISP=(NEW,KEEP),UNIT=SYSDA // PEND //STEP1 EXEC PROC1 //
21Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
CATALOGED PROCEDURE
1. It must be a member of PDS
2. PEND statement is not mandatory
3. It can have a maximum of 255 steps
4. The name of the library (PDS) should be specified if cataloged library is not in the system defined library (SYS1.PROCLIB) using JES JOBPARM statement or JCLLIB statement
22Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
JCLLIB
Specifies the names of the private libraries the system has to search
for:
a) Procedures named on any EXEC statement
b) JCL referenced by the INCLUDE statement (after release 4)
ex: // INCLUDE MEMBER=MYJCL
The JCLLIB statement must be placed before the first EXEC
statement in the job
// JCLLIB ORDER=(library[,library]....)// JCLLIB ORDER=(MYPROC.JCL.PROCLIB,// MYPROC.JCL.PROCLIB1)
23Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Cataloged procedure
It must begin with a PROC statement and PEND is optional. It must
be cataloged in order to access it that is it must be a member of a
PDS.
//ER5077J JOB ,ABC, CLASS=A// JCLLIB ORDER=(ER5077.PROCLIB) //STEP1 EXEC MYPROC
//MYPROC PROC //STEP2 EXEC PGM=IEFBR14 //DD1 DD DSN=&&TEMP,SPACE1(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),// DISP=(NEW,KEEP),UNIT=SYSDA
Cataloged procedure :
• Cataloged procedure called through a JCL :
24Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Questions ??
If a JCL has two procedures, an instream procedure first and a cataloged procedure next with the same name, which one will be executed ?
//ER5077J JOB ,,NOTIFY=&SYSUID,CLASS=A //JCLLIB ORDER=(ER4857.PROCLIB) //MYPROC PROC //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=ER5077.TEST.CAT,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),// DISP=(NEW,DELETE),UNIT=SYSDA // PEND //STEP1 EXEC MYPROC //*
Answer :The Instream procedure will be executed
25Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Questions ??
If a JCL has two procedures, a cataloged procedure first and an instream procedure next with the same name which one will be executed ?
//ER5077J JOB ,,NOTIFY=&SYSUID,CLASS=A // JCLLIB ORDER=(ER5077.PROCLIB) //STEP1 EXEC MYPROC //MYPROC PROC //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=ER5077.TEST.CAT,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),// DISP=(NEW,DELETE),UNIT=SYSDA // PEND //*
Answer :Cataloged procedure will be executed
26Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Nested Procedures
Cataloged and In-stream procedure can invoke other procedure
( up to 15 level)
An In-stream procedure cannot be defined within another
procedure
27Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Nested Procedures (examples)
//ER5077J JOB ,,NOTIFY=ER4857,CLASS=A //LIB1 JCLLIB ORDER=(ER5077.JCL.SOURCE) //FSTPROC PROC //STEP1 EXEC MYPROC // PEND //SNDPROC PROC //STEP1 EXEC FSTPROC // PEND //STEP1 EXEC SNDPROC //*
• SNDPROC is called first which calls FSTPROC which initiates cataloged procedure MYPROC
28Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Nested Procedures
• NSTPROC
//NSTPROC PROC //STEP1 EXEC PGM=IEFBR14
• MYPROC//MYPROC PROC //STEP1 EXEC NESTPROC //STEP2 EXEC PGM=IEFBR14,COND=(0,NE) //DD1 DD DSN=&&TEMP,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),// VOL=SER=INUSR3,// DISP=(NEW,KEEP),UNIT=SYSDA
• CALLJCL //ER5077J JOB ,,NOTIFY=&SYSUID,CLASS=A
// JCLLIB ORDER=(ER5077.PROCLIB) //STEP1 EXEC MYPROC
29Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Modifying the Procedure
SYMBOLIC PARAMETERS
OVERRIDING EXEC & DD PARAMETERS
30Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Symbolic Parameters
Symbolic parameters are variables used in procedures
Syntax - &Varname
Varname - 1-7 character
Value can be specified at :
1) SET statement
2) EXEC PROC statement
3) PROC statement
31Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Symbolic Parametersexamples ...
//ER5077J JOB ,,CLASS=A //SET1 SET A=ER5077.PDS.SAMPLE //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=&A,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),// DISP=(NEW,DELETE),UNIT=SYSDA
32Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Symbolic Parametersexamples ...
//ER5077J JOB ,, CLASS=A //MYPROC PROC A=ER5077.PDS.SAMPLE //STEP2 EXEC PGM=IEFBR14 //DD1 DD DSN=&A,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),// DISP=(NEW,DELETE),UNIT=SYSDA // PEND //STEP1 EXEC MYPROC
33Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
REFERING BACK
//ER5077J JOB ,,NOTIFY=&SYSUID,CLASS=A //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=ER5077.TEST.PS1,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),// DISP=(NEW,DELETE),UNIT=SYSDA //DD2 DD DSN=ER5077.TEST.PS2,SPACE=(TRK,(1,1)), // DCB=*.DD1,VOL=SER=INUSR3, // DISP=(NEW,DELETE),UNIT=SYSDA
34Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
REFERING BACK
//ER5077J JOB ,ABC,NOTIFY=&SYSUID,CLASS=A //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=ER5077.TEST.PS1,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80), // DISP=(NEW,CATLG),UNIT=SYSDA //STEP2 EXEC PGM=IEFBR14 //DD1 DD DSN=*.STEP1.DD1,SPACE=(TRK,(1,1)), // DCB=*.STEP1.DD1,VOL=SER=INUSR3, // DISP=(OLD,DELETE),UNIT=SYSDA
35Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
IBM UTILITY PROGRAMS
Provides a variety of useful function like Copying a member/data set Listing
Maintaining source libraries etc.
MVS provides a number of pre-written utility programs that can be used by analysts, system programmers, and application programmers to assist them in maintaining and organizing data.
36Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
UTILITY PROGRAMS
• SYSTEM UTILITY
• IEHLIST
• IEHMOVE
• IEHINITT
• IEHPROGM
• IFHSTATR
• DATA SET UTILITY
• IEBGENER
• IEBCOPY
• IEBCOMPR
• IEBPTPCH
• IEBDG
• IEBUPDTE
• IEBMOVE
• IEBEDIT
• IDCAMS
• IEFBR14
37Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
GENERAL FORMAT FOR IEBXXXX
//STEP EXEC PGM=IEBxxxx
//SYSPRINT DD (message data set ,no DCB)
//SYSIN DD (Control information for utility)
//SYSUT1 DD (input data set)
//SYSUT2 DD (output dataset)
38Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
IEBGENER utility
• It is used to copy one sequential file to another.
//ER5077J JOB ,ABC,CLASS=A,NOTIFY=&SYSUID //STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT2 DD DSN=ER5077.IEBGENER.NEWPS, // VOL=SER=INUSR2,SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800), // DISP=(NEW,CATLG) //SYSUT1 DD DSN=ER5077.INPUT.JCLPS1,DISP=SHR //SYSIN DD DUMMY
39Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
IEBCOPY
• To copy PDS on to DASD• To copy PDS on to Tapes by converting it to sequential dataset etc
//ER5077J JOB ,,CLASS=A,NOTIFY=ER5077 //STEP1 EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=ER5077.JCL.SOURCE,DISP=SHR //SYSUT2 DD DSN=ER5077.IEBCOPY.PDS, // VOL=SER=INUSR2,SPACE=(TRK,(5,5,8)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800), // DISP=(NEW,CATLG) //SYSIN DD * COPY INDD=SYSUT1,OUTDD=SYSUT2 /*
40Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
IEFBR14
• Using IEFBR14 you can create empty data sets or delete data sets
Allocate new flat files
//ER5077J JOB ,,CLASS=A,NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEFBR14,
//DD1 DD DSN=ER5077.JCL.PS,DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA, SPACE=(CYL(2,2),RLSE),
// DCB=(LRECL=80,BLKSIZE=0,RECFM=FB)
//SYSPRINT DD SYSOUT=*
41Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
SORT
• This can be used to sort, copy, merge data sets
• To SORT records in a dataset in ascending/descending order on given field(s)
//STEP1 EXEC PGM=SORT//SYSPRINT DD SYSOUT=*//SORTIN DD DSN=input data set,DISP=SHR//SORTOUT DD DSN=output data set,// DISP=(,CATLG),// DCB=*.SORTIN,// SPACE=(CYLS,(10,10),RLSE) //*//*************//* SORT CARD ://*************//SYSIN DD * SORT FIELDS=(1,05,CH,A),//*
42Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Review Questions
Instream procedure could be member of a PDS?
NO
A Catalogued procedure can call an Instream procedure? NO
Which type of parameters are used to customize the procedure?
Symbolic
Catalogued procedure can invoke other procedures beyond 20 levels?
No. Till 15 Levels.
43Copyright © 2005, Infosys Technologies Ltd
ER/CORP/CRS/OS02/003Version No: 1.0
Thank You!