Title: JCL
1 JCL DAY 3
2PROCEDURES
- It is a prepacked JCL.
- JCL needed by many different users
- A JCL executed on a repetitive basis
- JCL often repeated within the execution of a
single job
3TYPE 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
4Invoking a Procedure
- // EXEC procname
- // EXEC PROCprocname
- eg
- //name1 EXEC MYPROC
- //name1 EXEC PROCMYPROC
5JCLLIB
- Specifies the names of the private libraries the
system is to search for - Procedures named on any EXEC statement
- JCL referenced by the INCLUDE statement (after
release 4) - ex // INCLUDE MEMBERMYJCL
- The JCLLIB statement must be placed before the
first EXEC - statement in the job
// name JCLLIB ORDER(library,library....) /
/MYLIB JCLLIB ORDER(MYPROC.JCL.PROCLIB, // M
YPROC.JCL.PROCLIB1)
6PROCEDURES must not contain
- 1) JOB statement
- X 2) EXEC statement invoking a procedure
- 3) JOBLIB DD statement
- 4) DD , DD DATA - In-stream data
- 5) / delimiter statement
- 6) // Null statement
- 7) JES statements
- 8) PEND statement (for cataloged procedures)
7CATALOGED PROCEDURE
- It must be a member of PDS
- PEND statement is not permitted
- It can have a maximum of 255 steps
- 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
8In-stream procedure
- It must begin with a PROC statement and end with
a PEND statement - It should be coded before the first EXEC
statement invoking the instream procedure
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLAS
SA 000210 //PROC1 PROC
000220
//STEP2 EXEC PGMIEFBR14
000300 //DD1 DD DSNTEMP,SPACE(TRK,
(1,1)), 000400 //
DCB(RECFMFB,BLKSIZE800,LRECL80),VOLSERINUSR3
, 000500 // DISP(NEW,KEEP),UNITSYSDA
000600 // PEND
000610
//STEP1 EXEC PROC1
000700 /
9Cataloged procedure
- It must begin with a PROC statement and must not
contain a PEND statement - It must be cataloged in order to access it that
is it must be a member of a PDS.
000200 //MYPROC PROC
000210 //STEP2 EXEC
PGMIEFBR14
000220 //DD1 DD DSNTEMP,SPACE(TRK,(1,1)),
000230 //
DCB(RECFMFB,BLKSIZE800,LRECL80),VOLSERINUSR3
, 000240 // DISP(NEW,KEEP),UNITSYSDA
- Cataloged procedure called through a JCL
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLAS
SA 000110 //LIB1 JCLLIB ORDER(INF6244.JCL.SOURC
E) 000260 //STEP1 EXEC MYPROC
10Questions ??
If a JCL has two an instream procedure and a
cataloged procedure with the same name which one
will be executed ?
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLASS
A 000110 //LIB1 JCLLIB
ORDER(INF6244.JCL.SOURCE)
000120 //MYPROC PROC
000130 //STEP1 EXEC PGMIEFBR14
000140 //DD1
DD DSNINF6244.TEST.CAT,SPACE(TRK,(1,1)),
000150 // DCB(RECFMFB,BLKSIZE800,LRECL
80),VOLSERINUSR3, 000160 //
DISP(NEW,DELETE),UNITSYSDA
000170 // PEND
000180 //STEP1 EXEC MYPROC
000190 /
Answer Instream procedure will be executed
11Questions ??
If a JCL has two an instream procedure and a
cataloged procedure with the same name which one
will be executed ?
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLASS
A 000110 //LIB1 JCLLIB
ORDER(INF6244.JCL.SOURCE)
000111 //STEP1 EXEC MYPROC
000120 //MYPROC PROC
000130
//STEP1 EXEC PGMIEFBR14
000140 //DD1 DD DSNINF6244.TEST.CAT,SP
ACE(TRK,(1,1)), 000150 //
DCB(RECFMFB,BLKSIZE800,LRECL80),VOLSERINUSR3
, 000160 // DISP(NEW,DELETE),UNITSYSDA
000170 // PEND
000190 /
Answer Cataloged procedure will be executed
12Questions ??
Is the JCL given below correct? Yes/No , Justify
your answer ?
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLAS
SA 000110 //LIB1 JCLLIB ORDER(INF6244.JCL.SOURC
E) 000111 //TEST PROC
000112 //STEP1 EXEC MYPROC
000113 // PEND
000114 //STEP1 EXEC TEST
000115 /
Restriction relieve Procedure can have a exec
statement calling another procedure
13Nested Procedures
- Cataloged and In-stream procedure can invoke
other procedure ( up to 15 level) -
- An In-stream procedure cannot be defined within
- another procedure
14Nested Procedures (examples)
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLAS
SA 000110 //LIB1 JCLLIB ORDER(INF6244.JCL.SOU
RCE) 000111 //FSTPROC PROC
000112 //STEP1 EXEC MYPROC
000113 // PEND
000114 //SNDPROC
PROC 000115
//STEP1 EXEC FSTPROC
000116 // PEND
000120 //STEP1 EXEC SNDPROC
000130 /
- SNDPROC is called first which calls FSTPROC
which initiates - cataloged procedure MYPROC
15Nested Procedures (examples)
- NSTPROC
- 000200 //NSTPROC PROC
- 000201 //STEP1 EXEC
PGMIEFBR14
- MYPROC
- 000200 //MYPROC PROC
- 000201 //STEP1 EXEC NESTPROC
- 000210 //STEP2 EXEC
PGMIEFBR14,COND(0,NE) - 000220 //DD1 DD
DSNTEMP,SPACE(TRK,(1,1)),
- 000230 //
DCB(RECFMFB,BLKSIZE800,LRECL80), - 000231 //
VOLSERINUSR3, - 000240 //
DISP(NEW,KEEP),UNITSYSDA
- CALLJCL
- 000100 //INF62441 JOB
(AMLAN),NOTIFYINF6244,CLASSA - 000110 //LIB1 JCLLIB
ORDER(INF6244.JCL.SOURCE) - 000260 //STEP1 EXEC MYPROC
16Identifying procedure statements injobs JCL
listing
Identifier Identifier
Meaning For In stream for
Catalogued Procedure procedure //
//
Statement from Input JCL
XX Statement from
procedure / X/
Procedure statement that you
modified XX
Procedure statements, other than
comment
statements that were
converted to comments
Comments and JES2/JES3
control statements
17Modifying the Procedure
- SYMBOLIC PARAMETERS
- OVERRIDING EXEC DD PARAMETERS
18Symbolic 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
19Symbolic Parameters examples ...
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLASS
A 000101 //SET1 SET
AINF6244.SYMB.TEST
000107 //STEP1 EXEC PGMIEFBR14
000109 //DD1 DD
DSNA,SPACE(TRK,(1,1)),
000110 // DCB(RECFMFB,BLKSIZE800,LRECL80
),VOLSERINUSR3, 000120 //
DISP(NEW,DELETE),UNITSYSDA
20Symbolic Parameters examples ...
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLAS
SA 000101 //MYPROC PROC
AINF6244.SYMB.TEST
000102 //STEP2 EXEC PGMIEFBR14
000103 //DD1 DD
DSNA,SPACE(TRK,(1,1)),
000104 // DCB(RECFMFB,BLKSIZE800,LRECL8
0),VOLSERINUSR3, 000105 //
DISP(NEW,DELETE),UNITSYSDA
000106 // PEND
000107 //STEP1 EXEC MYPROC
21Question ??
- What will happen if the same symbolic parameters
having different - values are declared in the PROC, SET statement
of the cataloged - procedure SET statement of the calling JCL ?
- State the order of precedence ?
22REFERING BACK AND MODIFYING (examples)
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLAS
SA 000102 //STEP1 EXEC
PGMIEFBR14
000103 //DD1 DD DSNINF6244.TEST.PS1,SPACE(TRK,(1
,1)), 000104 //
DCB(RECFMFB,BLKSIZE800,LRECL80),VOLSERINUSR3
, 000105 // DISP(NEW,DELETE),UNITSYSDA
000106 //DD2 DD
DSNINF6244.TEST.PS2,SPACE(TRK,(1,1)),
000107 // DCB.DD1,VOLSERINUSR3,
000108 //
DISP(NEW,DELETE),UNITSYSDA
23REFERING BACK AND MODIFYING (examples)
000100 //INF62441 JOB (AMLAN),NOTIFYINF6244,CLASS
A 000101 //STEP1 EXEC PGMIEFBR14
000102 //DD1
DD DSNINF6244.TEST.PS1,SPACE(TRK,(1,1)),
000103 // DCB(RECFMFB,BLKSIZE800,LRE
CL80),VOLSERINUSR3, 000104 //
DISP(NEW,CATLG),UNITSYSDA
000105 //STEP2 EXEC PGMIEFBR14
000106 //DD1 DD
DSN.STEP1.DD1,SPACE(TRK,(1,1)),
000107 // DCB.STEP1.DD1,VOLSER
INUSR3, 000108
24Questions ??
- Can all the parameters of DD statement refer
back. Discuss ?
25IBM UTILITY PROGRAMS
- 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.
- Provides a variety of useful function like
- Copying a member/data set
- Listing
- Maintaining source libraries etc.
26UTILITY PROGRAMS
- SYSTEM UTILITY
- IEHATLAS
- IEHINITT
- IEHMOVE
- IEHPROGM
- IFHSTATR
- DATA SET UTILITY
- IEBCOMPR
- IEBCOPY
- IEBDG
- IEBEDIT
- IEBGENER
- IEBISAM
27GENERAL FORMAT FOR IEBXXXX
- //STEP EXEC PGMIEBxxxx
- //SYSPRINT DD -message data set ,no DCB
- //SYSIN DD -control information for utility
- //SYSUT1 DD -input data set
- //SYSUT2 DD -output dataset
28IEBGENER utility
- It is used to copy one sequential file to
another.
000001 //INF6244B JOB CLASSA,NOTIFYINF6244
000002 //STEP1 EXEC PGMIEBGENER
000003 //SYSPRINT DD SYSOUT
000004 //SYSUT2 DD DSNINF6244.IEBGENE
R.NEWPS, 000005 // VOLSERINUSR2,SPACE(TR
K,(1,1)), 000006 // DCB(RECFMFB,LRECL
80,BLKSIZE800), 000007 //
DISP(NEW,CATLG)
000008 //SYSUT1 DD DSNINF6244.INPUT.JCLPS1,DISP
SHR 000009 //SYSIN DD DUMMY
29IEBCOPY
- To copy PDS on to DASD
- To copy PDS on to Tapes by converting it to
sequential dataset etc
000001 //INF6244A JOB NOTIFYINF6244
000002 //STEP1 EXEC PGMIEBCOPY
000003 //SYSPRINT DD SYSOUTA
000004 //SYSUT1 DD DSNINF6244.JCL.SOURC
E,DISPSHR 000005 //SYSUT2 DD
DSNINF6244.IEBCOPY.PDS, 000006 //
VOLSERINUSR2,SPACE(TRK,(5,5,8)), 000007
// DCB(RECFMFB,LRECL80,BLKSIZE800),
000008 // DISP(NEW,CATLG)
000009 //SYSIN DD
000010 COPY INDDSYSUT1,OUTDDSYSUT2
000011 /
30IEHPROGM PROGRAM
- SCRATCHES
- RENAMES
- CATALOGS
- UNCATALOGS
- UTILITY CONTROL STATEMENTS
- SCRATCH DSNAMEdsname,VOLdeviceserial
- UNCATLG DSNAMEdsname
31IEHLIST PROGRAM
- LIST CATALOG
- LIST PDS
- LIST VTOC
- UTILITY CONTROL STATEMENT
- LISTPDS DSNAMEdsname,
x VOLdeviceserial,format - LISTVTOC DSNAMEdsname,
x VOLdeviceserial,format
32Thats all for DAY 3