JCL various libraries

TutorialBrain - JOBLIB vs STEPLIB Library
An image showing JOBLIB and STEPLIB

In JCL, there are different types of libraries. The important libraries which you should keep in mind when you want to code a JCL are –

  • JOBLIB
  • STEPLIB
  • JCLLIB
  • COPYLIB
  • PROCLIB

JOBLIB in JCL

TutorialBrain - JOBLIB Library

– JOBLIB is an optional library
– It is a private library where the load libraries of the programs which will be used in the ‘EXEC’ statements are created.
– We can use this only at Job the level. This means, there can be only one JOBLIB  in a JCL
– JOBLIB is a PDS or PDSE library.
– We ideally code this just after the JOB statement(JOB Card) and before the first EXEC statement.
– You can use multiple load libraries in JOBLIB using concatenation. We use this to make sure that the load modules of the programs get a search from the private libraries first. System libraries get a scan if the program is not found in the JOBLIB. If the programs are not found in system libraries, the JCL will throw an error.
– If both STEPLIB and JOBLIB are defining, STEPLIB takes higher priority. STEPLIB are discussed below.

Example for JOBLIB

//JOBLIB   DD DSN=MATEKS.TEST.LOADLIB,DISP=SHR

JCL STEPLIB

TutorialBrain - Example showing STEPLIB
TutorialBrain - Example showing load module of STEPLIB library
TutorialBrain - Example showing load module of a program which is present inside a STEPLIB library

– STEPLIB is an optional and private library
– STEPLIB is a PDS or PDSE library.
– Use STEPLIB only at step level i.e. at EXEC statement.
– The executable load module of the program of a particular step is either kept in the   JOBLIB or STEPLIB library.
– Sometimes, if a load module of the program is not present in a JOBLIB, then a STEPLIB is coded at ‘EXEC’ statement so that the program which is present in that step can pick the program from the STEPLIB library.
– STEPLIB always overrides JOBLIB in priority. This means that a STEPLIB has higher priority than JOBLIB. The Load module of the Program for a particular step will be first searched in STEPLIB. If it is not present in STEPLIB, it will be searched in JOBLIB

Example of a STEPLIB

//STEPLIB DD DSN=MATEKS.LOADLIB,DISP=SHR

JCLLIB

TutorialBrain- JCLLIB Libbrary
TutorialBrain- JCLLIB Library

– JCLLIB is an optional Private library
– JCLLIB is a PDS or PDSE library.
– JCL allows only one JCCLIB.
–  We use JCLLIB  to include either a procedure (PROC) that we use in all steps or to include member groups and it uses the keyword ‘ORDER’ to include these.

JCLLIB Syntax

//[opt-name] JCLLIB ORDER=LIB

OR

//[opt-name] JCLLIB ORDER=(LIB-1,LIB-2,…)

COPYLIB in JCL

TutorialBrain - COPYLIB Library
TutorialBrain - COPYLIB Library

COPYLIB is an optional Private library where the Copybooks which are used in the programs are kept.

Syntax of COPYLIB

//      COPYLIB=COPYBOOK-PDS-LIBRARY

JCL PROCLIB

PROCLIB is often a system defined library where the load modules of the programs will be searched only if the JCLLIB does not contain the load module of the program.

JCL Interview Question and Answers

1. Consider the below procedure, (choose 2)

Procedure C:
           //C       PROC
           //CS1     EXEC  PGM=CCC
           //CS1DD1  DD    DSNAME=A.B.C,DISP=SHR
           //CS1DD2  DD    SYSOUT=A
           //        PEND
		   
Procedure B:
           //B       PROC
           //BS1     EXEC  PROC=C
           //CS1.CS1DD1  DD  DSNAME=X.Y.Z       
           //CS1.CS1DD3  DD  SYSOUT=A           
           //BS2     EXEC  PGM=BBB
           //BS2DD1  DD    DSNAME=E,DISP=SHR
           //        PEND
  1. The addition of Step CS1.CS1DD3 in procedure B is valid
  2. The override of step CS1.CS1DD1 in procedure B is invalid
  3. The addition of Step CS1.CS1DD3 in procedure B is invalid
  4. None of the above
  5. The override of step CS1.CS1DD1 in procedure B is valid
  1. The addition of Step CS1.CS1DD3 in procedure B is valid
  2. The override of step CS1.CS1DD1 in procedure B is valid

2.  Libraries on the JCLLIB statement will be searched for,

a. Procedure named on EXEC statement
b. Member named on INCLUDE statement
c. Load modules on EXEC statement
d. Both a & b

d. Both a & b

4. When a JOBLIB and a STEPLIB is provided which has better priority

a. JOBLIB will override the STEPLIB.
b. Both nullifies each other.
c. STEPLIB overrides the JOBLIB.
d. None of the above.

c. STEPLIB overries the JOBLIB.

5. When a Region is coded both on the JOB card and STEP card which will override the other

a. JOB will override the STEP
b. STEP will override the JOB
c. Both will Nullify each other
d. None of the above

a. JOB will override the STEP

Tutorials for all brains!