In this topic, we described about the JOBLIB with detailed example.
JOBLIB is a private library. JOBLIB used to specify the private library where the step EXEC program load resides. JOBLIB libraries are of type PDS or PDSE on direct access device.
Each member in the PDS is a user written program and executable. The JOBLIB DD statement is used to identify the program library to search first when attempting to locate programs that should execute during the job execution.
The JOBLIB should be placed in between the JOB Card and first EXEC statement. More than one library can be concatenated on the JOBLIB. If a STEPLIB DD is specified in a job that also has a JOBLIB, the STEPLIB takes precedence when searching for a program.
JOBLIB should not be coded in in-stream or cataloged procedures. JOBLIB is used to specify the library where the programs load resides that are all executing in the JOB.
This JOBLIB will be used to specify the load library if it is the load library for more than one program in the entire JCL. If more than one loadlib provided in JOBLIB, the order of searching for the load by the system is same as how they coded in JOBLIB.
//JOBLIB DD parameter[,parameter]... [comments]
Private library is the library where the program executable placed.
//JOBLIB DD DSNAME=MTH.JLOADLIB,DISP=SHR //STEP1 EXEC PGM=PROG1 //STEP2 EXEC PGM=PROG2
The system searches for the programs PROG1 and PROG2 first in MTH.JLOADLIB, then in SYS1.LINKLIB.
//JOBLIB DD DSNAME=MTH.LOADLIB1,DISP=SHR // DD DSNAME=MTH.LOADLIB2,DISP=SHR //STEP1 EXEC PGM=PROG1 //STEP2 EXEC PGM=PROG2
The system searches MTH.LOADLIB1 and MTH.LOADLIB2 for the program PROG1 for PROG2.
//JOBLIB DD DSNAME=MTH.JLOADLIB,DISP=SHR //STEP01 EXEC PGM=PROG1 //STEPLIB DD DSNAME=MTH.LOADLIB,DISP=SHR //STEP2 EXEC PGM=PROG2
The system searches MTH.LOADLIB for the program PROG1. The system searches MTH.JLOADLIB for PROG2 as no STEPLIB defined for it.