TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB Tools Articles Forum Quiz Interview Q&A

JCL - Cataloged Procedure


Let see an example to understand cataloged procedure,

Example:

//TESTCTLG JOB 100,CLASS=C,MSGCLASS=Y,NOTIFY=&SYSUID
//*
//MYLIBS1  JCLLIB  ORDER=MYCOBOL.BASE.PROCLIB
//*
//STEP1 EXEC CTLGPROC
//*

In this example job:

Your JCL begins with a JOB statement that names your job TESTCTLG.

The first step in TESTCTLG, named STEP1, Identifies CTLGPROC as the JCL procedure to be run.

Here, the procedure CTLGPROC is present in MYCOBOL.BASE.PROCLIB library. See below,

//CTLGPROC PROC
//*
//PROC1		EXEC PGM=SORT
//SORTIN	DD DSN=HLQ.FILE.INPUT,DISP=SHR
//SORTOUT	DD DSN=HLQ.FILE.OUTPUT,DISP=SHR
//SYSOUT	DD SYSOUT=*
//SYSIN		DD DSN=HLQ.APP.CARDLIB(SORTCARD),DISP=SHR
//*

Have you noted JCLLIB statement in example JCL?

//MYLIBS1 JCLLIB ORDER=MYCOBOL.BASE.PROCLIB

The JCLLIB statement allows you to code and use procedures and INCLUDE groups in a private library without the need to use system procedure libraries.

You can code only one JCLLIB statement per job.

Let us assume that the system default procedure library includes SYS1.PROCLIB only. If you do not specify the JCLLIB statement, then the system searches only SYS1.PROCLIB. (Using a procedure describes how the system determines the default procedure library.)

So, We need JCLLIB statement to override the system proc library.

For example,

//MYJOB1   JOB     ...
//MYLIBS1  JCLLIB  ORDER=MYCOBOL.BASE.PROCLIB
//S1       EXEC    PROC=MYPROC1

Now the system searches the libraries for procedure MYPROC1 in the following order:
  1. MYCOBOL.BASE.PROCLIB

  2. SYS1.PROCLIB


Hope you understand why we added a JCLLIB statement in the example JCL. Proc CTLGPROC is present in MYCOBOL.BASE.PROCLIB library.


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal