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:

    1. Library specified in STEPLIB statement
    2. Library specified in JOBLIB statement
    3. LPA or ELPA
    4. 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.PDSELIB for the routine PROGRAM1 and USER.PDSELIB2 for the routine PROGRAMA:
    //JOB8    JOB  DAVE,MSGLEVEL=(2,0)
    //STEP1   EXEC PGM=PROGRAM1
    //STEPLIB DD   DSNAME=USER.PDSELIB,DISP=SHR
    //*
    //STEP2   EXEC PGM=PROGRAMA
    //STEPLIB DD   DSNAME=USER.PDSELIB2,DISP=SHR
  • With the ddname JOBLIB immediately after the JOB statement in your JCL. This library is searched before the system libraries. If any AMODE 64 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.PDSELIB for the member PROGRAM1, reads the member into storage, and executes it.

    //JOB8    JOB  DAVE,MSGLEVEL=(2,0)
    //JOBLIB  DD   DSNAME=USER.PDSELIB,DISP=SHR
    //STEP1   EXEC PGM=PROGRAM1