Program library definition and search order
You can define the library in a DD statement in the following ways:
- With the ddname STEPLIB at any point in the job step. The STEPLIB
is searched before any system library or JOBLIB specified in a JOBLIB
DD statement for the job step in which it appears (although an executable
program can also be passed to subsequent job steps in the usual way).
When a STEPLIB and JOBLIB are both present, the STEPLIB is searched
for the step in which it appears and, for that step, the JOBLIB is
ignored.
The system searches for executable programs in the following order of precedence:
- Library specified in STEPLIB statement
- Library specified in JOBLIB statement
- LPA or ELPA
- The system library SYS1.LINKLIB and libraries concatenated to it through the active LNKLSTxx member of SYS1.PARMLIB
In the following example, the system searches USER.LOADLIB for the routine PROGRAM1 and USER.LOADLIB2 for the routine PROGRAMA://JOB8 JOB DAVE,MSGLEVEL=(2,0) //STEP1 EXEC PGM=PROGRAM1 //STEPLIB DD DSNAME=USER.LOADLIB,DISP=SHR //* //STEP2 EXEC PGM=PROGRAMA //STEPLIB DD DSNAME=USER.LOADLIB2,DISP=SHR
- With the ddname JOBLIB immediately after the JOB statement in
your JCL. This library is searched before the system libraries. If
any executable program is not found in the JOBLIB, the system looks
for it in the system libraries.
In the following example, the system searches the private library USER.LOADLIB for the member PROGRAM1, reads the member into storage, and executes it.
//JOB8 JOB DAVE,MSGLEVEL=(2,0) //JOBLIB DD DSNAME=USER.LOADLIB,DISP=SHR //STEP1 EXEC PGM=PROGRAM1