Libraries


JCL library normally refers to a dataset or collection of datasets that contain reusable JCL code or procedures. These libraries help organize and manage commonly used JCL components and make them easily accessible for multiple jobs. There are several types of libraries in JCL -

  • System libraries
  • User-defined libraries

System libraries -


A system library contains standard or system-defined JCL procedures and utilities provided by the mainframe operating system. These procedures are important for performing various system tasks and operations. z/OS has many standard system libraries and few important libraries include -

  • SYS1.LINKLIB - contains many of the basic execution modules of the system.
  • SYS1.PROCLIB - contains JCL procedures distributed with z/OS.
  • SYS1.PARMLIB - contains control parameters for z/OS and for some program products.
  • SYS1.LPALIB - contains system execution modules loaded into the link pack area when the system is initialized. Programs stored here are available to other address spaces.
  • SYS1.NUCLEUS - contains the basic kernel modules of z/OS.
  • SYS1.SVCLIB - contains operating system routines known as SVCs.

User-defined libraries -


System administrators or users create user-defined libraries to store their own JCL code and procedures. These libraries are coded with system-defined DD statements like - STEPLIB, JOBLIB, PROCLIB, JCLLIB, and COPYLIB.

There are several system-defined DD statements in JCL, including -

STEPLIB

The STEPLIB is used to specify user-defined load library at the step level. When the job is submitted for execution, the system will search these libraries to find the load module of the program running at the step. A STEPLIB is optional and job step can have only one STEPLIB statement.

Syntax -

//STEPLIB DD DSN=load-library-name,DISP=SHR
Example - STEPLIB with one library.
//MTHEXMP1 JOB (META007),'PAWAN Y',NOTIFY=&SYSUID
//STEP01  EXEC PGM=PROG1
//STEPLIB DD   DSN=MTH.LOADLIB1,DISP=SHR
//STEP01  EXEC PGM=PROG2
//STEPLIB DD   DSN=MTH.LOADLIB2,DISP=SHR

In the above example, system searches PROG1 in MTH.LOADLIB1 and PROG2 in MTH.LOADLIB2.


JOBLIB

The JOBLIB is used to specify user-defined load library at the job level. When the job is submitted for execution, the system will search these libraries to find the load module of the program running at each step. A JOBLIB is optional and job can have only one JOBLIB statement.

Syntax -

//JOBLIB DD DSN=library-name,DISP=SHR
Example - JOBLIB with one library.
//MTHEXMP1 JOB (META007),'PAWAN Y',NOTIFY=&SYSUID
//JOBLIB  DD   DSN=MTH.JLOADLIB,DISP=SHR
//STEP1   EXEC PGM=PROG1
//STEP2   EXEC PGM=PROG2

In the above example, system searches PROG1 and PROG2 in MTH.JLOADLIB.


JCLLIB

A JCLLIB statement is used to specify the private libraries that contain the cataloged procedures. The system searches the libraries in the same order coded on the JCLLIB statement. There is only one JCLLIB statement in a JCL.

Syntax -

//[DDname] JCLLIB ORDER=(library1[,library2,...])
  • library1,library2,.. - specifies the procedure libraries. Maximum 15 datasets can be coded.
Example - Coding single procedure library.
//MTHEXMP1 JOB (META007),'PAWAN Y',NOTIFY=&SYSUID
//MYLIBS   JCLLIB  ORDER=MTH.PROCLIB
//STEP01   EXEC PROC=MTHPROC
The system searches for procedure MTHPROC in the following order -
  • MTH.PROCLIB
  • SYS1.PROCLIB - System library.

PROCLIB

PROCLIB is used to specify a user-defined library where commonly used procedures are stored. It is a collection of reusable procedures, also known as cataloged procedures, that multiple jobs can call. PROCLIB should code before the first EXEC statement in the job.

Syntax -

//PROCLIB DD DSN=proclib-name...
Example - Coding MTH.PROCLIB as proc library.
//MTHEXMP1 JOB (META007),'PAWAN Y',NOTIFY=&SYSUID
//PROCLIB DD DSN=MTH.PROCLIB,DISP=SHR
//STEP01 EXEC MTHPROC
The system searches for procedure MTHPROC in the following order -
  • MTH.PROCLIB
  • SYS1.PROCLIB - System library.

COPYLIB

COPYLIB is used to specify the copybook library in the compilation step of the JCL. It is a PDS, and each member contains the copybook layout that is used by many application programs.

Syntax -

//SYSLIB DD DSN=library-name,DISP=SHR
  • library-name is the PDS where the copybook resides.
Example - Coding a single COPY library.
//COB  EXEC PGM=IGYCRCTL,REGION=4M,
//          PARM='NODYNAM,LIB,OBJECT,RES,APOST,MAP,XREF' 
//STEPLIB  DD DSN=IGY420.SIGYCOMP,DISP=SHR 
//SYSLIB   DD DSN=MTH.TEST.COPYLIB,DISP=SHR
//            DSN=MTH.AIT.COPYLIB,DISP=SHR
//            DSN=MTH.PROD.COPYLIB,DISP=SHR
...

The system searches the libraries for copy libraries in the following order -

  1. MTH.TEST.COPYLIB
  2. MTH.AIT.COPYLIB
  3. MTH.PROD.COPYLIB
Learn More?