Reusable JCL collection
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


JCL DD statements: Identify program libraries with JOBLIB or STEPLIB

Reusable JCL collection

To successfully run the program that you specify on a JCL EXEC statement, z/OS® has to search for and find that program. Using JOBLIB or STEPLIB DD statements can reduce search time.

When you code the PGM parameter, z/OS looks for a program, and will automatically search standard system program libraries, such as SYS1.LINKLIB, which contains IBM-supplied programs. If the program you want to run resides in a private program library, you must specify either a JOBLIB DD statement or a STEPLIB DD statement for z/OS to successfully locate the program.

Although both the JOBLIB DD statement and the STEPLIB DD statement identify one or more private libraries as the location of a specified program, they dictate different search behaviors for z/OS:
  • JOBLIB tells z/OS to search the private libraries for each step in the job
  • STEPLIB tells z/OS to search the private libraries only for one step
In both cases, z/OS searches system libraries only if it does not find the program first in the private libraries on the JOBLIB or STEPLIB DD statement.

To decide which DD statement is most efficient for you to use, you need to know the location of the programs to be run. If most are in the same private library, for example, the JOBLIB DD statement is probably the best choice. If only a few programs are in private libraries, the STEPLIB DD statement is probably the most efficient.

In this example, a JOBLIB DD statement names the private library in which PROGRAM1 resides:
//JOBNUM1 JOB  504,SMITH  PAYROLL
//JOBLIB  DD   DSN=MY.LIBRARY,DISP=SHR//STEP1   EXEC PGM=PROGRAM1
//DD1     DD   DSN=HLQ.INPUT
//
In this example, a STEPLIB DD statement names the private library in which PROGRAM1 resides:
//JOBNUM1 JOB  504,SMITH  PAYROLL
//STEP1   EXEC PGM=PROGRAM1
//STEPLIB  DD   DSN=MY.LIBRARY,DISP=SHR//DD1     DD   DSN=HLQ.INPUT
//

If you code both a JOBLIB DD and STEPLIB DD statement in the same job, the STEPLIB DD statement overrides the JOBLIB statement only for the one step. For that step only, the system ignores JOBLIB and first searches the private libraries specified on the STEPLIB DD statement. If the system does not find the program in the private libraries, it then searches the system libraries. Then, if z/OS still has not found the program, the system abnormally ends the job step.





Copyright IBM Corporation 1990, 2010