STEPLIB


The STEPLIB is used to specify one or more user-defined libraries at the step level where the load module resides. When the job is submitted for execution, the system will search these libraries to find the load module running at the step.

When a program runs at the job step, the system searches for the required load module first in the STEPLIB libraries, and if it is not found, then it searches in the system libraries. If STEPLIB is not coded, the system searches in system libraries.

A job can have multiple STEPLIB statements. However, a job step can have only one STEPLIB statement. A STEPLIB is optional.

Syntax -

//STEPLIB DD DSN=library-name,DISP=SHR  [comments]

Where:

  • library-name is the PDS where the program load modules resides.

Notes -

  • If the system can't find the program in the coded library, it starts checking in system libraries.
  • A maximum of 255 STEPLIBs can be coded in the JOB.
  • If a STEPLIB DD is coded in a job that also has a JOBLIB, the STEPLIB takes precedence when searching for a program for the particular step.
  • If more than one library is coded in STEPLIB, the order of searching for the load by the system is the same as how they are coded in STEPLIB.

Examples -


Scenario1 - STEPLIB with one library

//MTHEXMP1 JOB (META007),'PAWAN Y',NOTIFY=&SYSUID
//STEP01  EXEC PGM=PROG1
//STEPLIB DD   DSN=MTH.LOADLIB1,DISP=SHR
//STEP02  EXEC PGM=PROG2
//STEPLIB DD   DSN=MTH.LOADLIB2,DISP=SHR

The system searches MTH.LOADLIB1 for the program PROG1 and MTH.LOADLIB2 for PROG2.

Scenario2 - STEPLIB with multiple libraries

//MTHEXMP1 JOB (META007),'PAWAN Y',NOTIFY=&SYSUID
//STEP2   EXEC PGM=PROG1
//STEPLIB DD   DSN=MTH.LOADLIB1,DISP=SHR
//        DD   DSN=MTH.LOADLIB2,DISP=SHR

The system searches MTH.LOADLIB1 and MTH.LOADLIB2 for the program PROG1.

Scenario3 - STEPLIB and JOBLIB.

//MTHEXMP1 JOB (META007),'PAWAN Y',NOTIFY=&SYSUID
//JOBLIB  DD   DSN=MTH.JLOADLIB,DISP=SHR
//STEP01  EXEC PGM=PROG1
//STEPLIB DD   DSN=MTH.LOADLIB,DISP=SHR
//STEP2   EXEC PGM=PROG2

The system searches MTH.LOADLIB and MTH.JLOADLIB for the program PROG1. The system searches MTH.JLOADLIB for PROG2 as no STEPLIB is coded in STEP2.