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 //* |
//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 //* |
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 |
MYCOBOL.BASE.PROCLIB
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!