Cataloged Procedure


The procedure defined outside of the JCL is called as cataloged procedure.

Cataloged procedures are defined outside of the JCL and maintained independently of any JCL. The library can be a personal or system library of type PDS. The library should be coded in JCL with PROCLIB|JCLLIB statement to include the procedure.

The name of the cataloged procedure is a member name or alias name in the library. The cataloged procedure is only validated for syntax errors when an EXEC statement calls it. A maximum of 255 procedures can be coded in a single JCL.

Syntax -

Defintion -

//proc-name PROC 
//jcl-statements

Calling -

//step-name JCLLIB ORDER=(cataloged-procedure-library)   //*mandatory
//*
//step-name EXEC proc-name 
or
//step-name EXEC PROC=proc-name

Rules -

  • PROCLIB|JCLLIB is mandatory to provide the library where the cataloged procedures are placed.
  • Cataloged procedure allows CNTL, command, DD, ENDCNTL, EXEC, IF/THEN/ELSE/ENDIF, INCLUDE, OUTPUT JCL, and SET statements only.
  • Cataloged procedure can be coded in another catalog procedure.
  • PEND is not mandatory in the cataloged procedure.

Default and overrides -

To override a default parameter value on a PROC statement, code the same parameter on the EXEC statement that calls the procedure.

Examples -


Scenario1 - JCL to create two PS files with same parameters.

//MTHUSERC JOB (MTH1234),'PAWAN Y',CLASS=B,NOTIFY=&SYSUID
//STEP01   EXEC PGM=IEFBR14
//DD1      DD DSN=MATEPK.IEFBR14.PSFILE1,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(3,2),RLSE),
//            UNIT=SYSDA,VOLUME=SER=DEVHD4, 
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//STEP02   EXEC PGM=IEFBR14
//DD1      DD DSN=MATEPK.IEFBR14.PSFILE2, 
//            DISP=(NEW,CATLG,DELETE), 
//            SPACE=(TRK,(3,2),RLSE), 
//            UNIT=SYSDA,VOLUME=SER=DEVHD4, 
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)

Same above JCL using Cataloged Proc concept -

Cataloged procedure definition (MATEPK.JCL.LIB) -

//CREATEPS PROC
//STEPA    EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*  
//SYSOUT   DD SYSOUT=*
//SYSDUMP  DD SYSOUT=*
//DD1      DD DSN=&PSNAME,
//            DISP=(NEW,CATLG,DELETE), 
//            SPACE=(TRK,(3,2),RLSE), 
//            UNIT=SYSDA,VOLUME=SER=DEVHD4,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)

JCL calling cataloged procedure -

//MATEPKPS JOB (MTH1234),'PAWAN Y',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//PLIB    JCLLIB ORDER=(MATEPK.JCL.LIB)
//*
//STEP10   EXEC CREATEPS,PSNAME=MATEPK.TEST.PSFILE1
//STEP20   EXEC CREATEPS,PSNAME=MATEPK.TEST.PSFILE2