360 likes | 660 Views
JCL DAY 3. PROCEDURES. 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. TYPE OF PROCEDURES. In-stream procedures Coded in the executing job max of 15 per JOB Catalogued Procedure
E N D
JCL DAY 3 ER/CORP/CRS/OS02/003-3
PROCEDURES 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 ER/CORP/CRS/OS02/003-3
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 ER/CORP/CRS/OS02/003-3
Invoking a Procedure // EXEC procname // EXEC PROC=procname eg: //name1 EXEC MYPROC //name1 EXEC PROC=MYPROC ER/CORP/CRS/OS02/003-3
JCLLIB 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 MEMBER=MYJCL • 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, // MYPROC.JCL.PROCLIB1) ER/CORP/CRS/OS02/003-3
PROCEDURES 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) ER/CORP/CRS/OS02/003-3
CATALOGED 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 ER/CORP/CRS/OS02/003-3
In-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),NOTIFY=INF6244,CLASS=A 000210 //PROC1 PROC 000220 //STEP2 EXEC PGM=IEFBR14 000300 //DD1 DD DSN=&&TEMP,SPACE=(TRK,(1,1)), 000400 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),VOL=SER=INUSR3, 000500 // DISP=(NEW,KEEP),UNIT=SYSDA 000600 // PEND 000610 //STEP1 EXEC PROC1 000700 /* ER/CORP/CRS/OS02/003-3
Cataloged 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. • Cataloged procedure: 000200 //MYPROC PROC 000210 //STEP2 EXEC PGM=IEFBR14 000220 //DD1 DD DSN=&&TEMP,SPACE=(TRK,(1,1)), 000230 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),VOL=SER=INUSR3, 000240 // DISP=(NEW,KEEP),UNIT=SYSDA • Cataloged procedure called through a JCL : 000100 //INF62441 JOB (AMLAN),NOTIFY=INF6244,CLASS=A 000110 //LIB1 JCLLIB ORDER=(INF6244.JCL.SOURCE) 000260 //STEP1 EXEC MYPROC ER/CORP/CRS/OS02/003-3
Questions ?? 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),NOTIFY=INF6244,CLASS=A 000110 //LIB1 JCLLIB ORDER=(INF6244.JCL.SOURCE) 000120 //MYPROC PROC 000130 //STEP1 EXEC PGM=IEFBR14 000140 //DD1 DD DSN=INF6244.TEST.CAT,SPACE=(TRK,(1,1)), 000150 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),VOL=SER=INUSR3, 000160 // DISP=(NEW,DELETE),UNIT=SYSDA 000170 // PEND 000180 //STEP1 EXEC MYPROC 000190 /* Answer : Instream procedure will be executed ER/CORP/CRS/OS02/003-3
Questions ?? 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),NOTIFY=INF6244,CLASS=A 000110 //LIB1 JCLLIB ORDER=(INF6244.JCL.SOURCE) 000111 //STEP1 EXEC MYPROC 000120 //MYPROC PROC 000130 //STEP1 EXEC PGM=IEFBR14 000140 //DD1 DD DSN=INF6244.TEST.CAT,SPACE=(TRK,(1,1)), 000150 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),VOL=SER=INUSR3, 000160 // DISP=(NEW,DELETE),UNIT=SYSDA 000170 // PEND 000190 /* Answer : Cataloged procedure will be executed ER/CORP/CRS/OS02/003-3
Questions ?? Is the JCL given below correct? Yes/No , Justify your answer ? 000100 //INF62441 JOB (AMLAN),NOTIFY=INF6244,CLASS=A 000110 //LIB1 JCLLIB ORDER=(INF6244.JCL.SOURCE) 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 ER/CORP/CRS/OS02/003-3
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 ER/CORP/CRS/OS02/003-3
Nested Procedures (examples) 000100 //INF62441 JOB (AMLAN),NOTIFY=INF6244,CLASS=A 000110 //LIB1 JCLLIB ORDER=(INF6244.JCL.SOURCE) 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 ER/CORP/CRS/OS02/003-3
Nested Procedures (examples) • NSTPROC • 000200 //NSTPROC PROC • 000201 //STEP1 EXEC PGM=IEFBR14 • MYPROC • 000200 //MYPROC PROC • 000201 //STEP1 EXEC NESTPROC • 000210 //STEP2 EXEC PGM=IEFBR14,COND=(0,NE) • 000220 //DD1 DD DSN=&&TEMP,SPACE=(TRK,(1,1)), • 000230 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80), • 000231 // VOL=SER=INUSR3, • 000240 // DISP=(NEW,KEEP),UNIT=SYSDA • CALLJCL • 000100 //INF62441 JOB (AMLAN),NOTIFY=INF6244,CLASS=A • 000110 //LIB1 JCLLIB ORDER=(INF6244.JCL.SOURCE) • 000260 //STEP1 EXEC MYPROC ER/CORP/CRS/OS02/003-3
Identifying procedure statements injob’s 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 ER/CORP/CRS/OS02/003-3
Modifying the Procedure SYMBOLIC PARAMETERS OVERRIDING EXEC & DD PARAMETERS ER/CORP/CRS/OS02/003-3
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 ER/CORP/CRS/OS02/003-3
Symbolic Parameters examples ... 000100 //INF62441 JOB (AMLAN),NOTIFY=INF6244,CLASS=A 000101 //SET1 SET A=INF6244.SYMB.TEST 000107 //STEP1 EXEC PGM=IEFBR14 000109 //DD1 DD DSN=&A,SPACE=(TRK,(1,1)), 000110 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),VOL=SER=INUSR3, 000120 // DISP=(NEW,DELETE),UNIT=SYSDA ER/CORP/CRS/OS02/003-3
Symbolic Parameters examples ... 000100 //INF62441 JOB (AMLAN),NOTIFY=INF6244,CLASS=A 000101 //MYPROC PROC A=INF6244.SYMB.TEST 000102 //STEP2 EXEC PGM=IEFBR14 000103 //DD1 DD DSN=&A,SPACE=(TRK,(1,1)), 000104 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),VOL=SER=INUSR3, 000105 // DISP=(NEW,DELETE),UNIT=SYSDA 000106 // PEND 000107 //STEP1 EXEC MYPROC ER/CORP/CRS/OS02/003-3
Question ?? • 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 ? ER/CORP/CRS/OS02/003-3
REFERING BACK AND MODIFYING (examples) 000100 //INF62441 JOB (AMLAN),NOTIFY=INF6244,CLASS=A 000102 //STEP1 EXEC PGM=IEFBR14 000103 //DD1 DD DSN=INF6244.TEST.PS1,SPACE=(TRK,(1,1)), 000104 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),VOL=SER=INUSR3, 000105 // DISP=(NEW,DELETE),UNIT=SYSDA 000106 //DD2 DD DSN=INF6244.TEST.PS2,SPACE=(TRK,(1,1)), 000107 // DCB=*.DD1,VOL=SER=INUSR3, 000108 // DISP=(NEW,DELETE),UNIT=SYSDA ER/CORP/CRS/OS02/003-3
REFERING BACK AND MODIFYING (examples) 000100 //INF62441 JOB (AMLAN),NOTIFY=INF6244,CLASS=A 000101 //STEP1 EXEC PGM=IEFBR14 000102 //DD1 DD DSN=INF6244.TEST.PS1,SPACE=(TRK,(1,1)), 000103 // DCB=(RECFM=FB,BLKSIZE=800,LRECL=80),VOL=SER=INUSR3, 000104 // DISP=(NEW,CATLG),UNIT=SYSDA 000105 //STEP2 EXEC PGM=IEFBR14 000106 //DD1 DD DSN=*.STEP1.DD1,SPACE=(TRK,(1,1)), 000107 // DCB=*.STEP1.DD1,VOL=SER=INUSR3, 000108 ER/CORP/CRS/OS02/003-3
Questions ?? • Can all the parameters of DD statement refer back. Discuss ? ER/CORP/CRS/OS02/003-3
IBM 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. ER/CORP/CRS/OS02/003-3
SYSTEM UTILITY IEHATLAS IEHINITT IEHMOVE IEHPROGM IFHSTATR DATA SET UTILITY IEBCOMPR IEBCOPY IEBDG IEBEDIT IEBGENER IEBISAM UTILITY PROGRAMS ER/CORP/CRS/OS02/003-3
GENERAL FORMAT FOR IEBXXXX //STEPEXEC PGM=IEBxxxx //SYSPRINT DD -message data set ,no DCB //SYSIN DD -control information for utility //SYSUT1 DD -input data set //SYSUT2 DD -output dataset ER/CORP/CRS/OS02/003-3
IEBGENER utility • It is used to copy one sequential file to another. 000001 //INF6244B JOB CLASS=A,NOTIFY=INF6244 000002 //STEP1 EXEC PGM=IEBGENER 000003 //SYSPRINT DD SYSOUT=* 000004 //SYSUT2 DD DSN=INF6244.IEBGENER.NEWPS, 000005 // VOL=SER=INUSR2,SPACE=(TRK,(1,1)), 000006 // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800), 000007 // DISP=(NEW,CATLG) 000008 //SYSUT1 DD DSN=INF6244.INPUT.JCLPS1,DISP=SHR 000009 //SYSIN DD DUMMY ER/CORP/CRS/OS02/003-3
IEBCOPY • To copy PDS on to DASD • To copy PDS on to Tapes by converting it to sequential dataset etc 000001 //INF6244A JOB NOTIFY=INF6244 000002 //STEP1 EXEC PGM=IEBCOPY 000003 //SYSPRINT DD SYSOUT=A 000004 //SYSUT1 DD DSN=INF6244.JCL.SOURCE,DISP=SHR 000005 //SYSUT2 DD DSN=INF6244.IEBCOPY.PDS, 000006 // VOL=SER=INUSR2,SPACE=(TRK,(5,5,8)), 000007 // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800), 000008 // DISP=(NEW,CATLG) 000009 //SYSIN DD * 000010 COPY INDD=SYSUT1,OUTDD=SYSUT2 000011 /* ER/CORP/CRS/OS02/003-3
IEHPROGM PROGRAM • SCRATCHES • RENAMES • CATALOGS • UNCATALOGS UTILITY CONTROL STATEMENTS SCRATCH DSNAME=dsname,VOL=device=serial UNCATLG DSNAME=dsname ER/CORP/CRS/OS02/003-3
IEHLIST PROGRAM • LIST CATALOG • LIST PDS • LIST VTOC UTILITY CONTROL STATEMENT LISTPDS DSNAME=dsname, x VOL=device=serial,format LISTVTOC DSNAME=dsname, x VOL=device=serial,format ER/CORP/CRS/OS02/003-3
That’s all for DAY 3 ER/CORP/CRS/OS02/003-3