Monday, 28 January 2013

Procedures :

when same code is used repetitively, then that code is coded seperately either in instream of JCL or as a member of PDS, which can be called in JCL. 
There are two tyes of procedures 
1) Cataloged procedures : 
Procedures which are saved as member of PDS. It doesn't have PEND statement at end.

CATPROC procedure saved in XX7384A.CATPROC.LIB

//CATPROC PROC
//STEP1      EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT    DD SYSOUT=*
//DD1          DD DSN=XX7384A.NEW.PS,
//                DISP=(NEW,CATLG,DELETE),
//                UNIT=SYSDA,
//                DCB=(LRECL=80,RECFM=FB,BLKSIZE=800),
//                SPACE=(CYL,(2,3))
//*


JCL to execute CATPROC procedure - 
//OZA201AS JOB (GENERAL),'CATPROC CALL',CLASS=A,NOTIFY=OZA201
//*
// JCLLIB ORDER=XX7384A.CATPROC.LIB
//STEP1  EXEC CATPROC
//* 
in this JCL CATPROC cataloged proceure is executed. 


2) Instream procedures : 
Procedure written instream of JCL is known as Instream procedure. Instream procedures are defined before exec statement. It starts with PROC statement and ends with PEND statment. Maximum 15 Instream procedures can be coded in on JOB.


//OZA201AS JOB (GENERAL),'INPROC CALL',CLASS=A,NOTIFY=OZA201
//*
//INPROC PROC
//STEP1       EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//DD1         DD DSN=XX7384A.NEW.PS,
//               DISP=(NEW,CATLG,DELETE),
//               UNIT=SYSDA,
//               DCB=(LRECL=80,RECFM=FB,BLKSIZE=800),
//               SPACE=(CYL,(2,3))
//             PEND
//*
//STEPX EXEC INPROC
//*

Here stepx is executing INPROC procedure. 

No comments:

Post a Comment