In this topic, we described about the STEPLIB with detailed example.
STEPLIB is a private library. STEPLIB used to specify the private load library where step EXEC program load resides. STEPLIB can be placed anywhere in the specific step.
If the system can’t able to find the program in specified library with STEPLIB, it will start checking in system libraries. STEPLIB libraries are of type PDS or PDSE on direct access device.
Each member in the PDS is a user written program and executable. The STEPLIB DD statement is used to identify the program library to search first when attempting to locate programs that should execute during the job step execution.
More than one library can be concatenated on the STEPLIB. If a STEPLIB DD is specified in a job that also has a JOBLIB, the STEPLIB takes precedence when searching for a program for the particular step.
STEPLIB can be coded in in-stream or cataloged procedures. STEPLIB is used to specify the library where the currently executing program load resides. STEPLIB is used to specify the load library for the specific step under the step it is coded.
Maximum 255 STEPLIBs can be coded in the JOB. If more than one loadlib provided in STEPLIB, the order of searching for the load by the system is same as how they coded in STEPLIB.
//STEPLIB DD parameter[,parameter]... [comments]
Private library is the library where the program executable placed.
//STEP01 EXEC PGM=PROG1 //STEPLIB DD DSNAME=MTH.LOADLIB1,DISP=SHR //STEP02 EXEC PGM=PROG2 //STEPLIB DD DSNAME=MTH.LOADLIB2,DISP=SHR
The system searches MTH.LOADLIB1 for the program PROG1 and MTH.LOADLIB2 for PROG2.
//STEP2 EXEC PGM=PROG1 //STEPLIB DD DSNAME=MTH.LOADLIB1,DISP=SHR // DD DSNAME=MTH.LOADLIB2,DISP=SHR
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.