Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 3: JCL EXEC Statement


JOBLIB and STEPLIB

JOBLIB and STEPLIB are DD (Data Definition) statements. Load module libraries are mentioned in JOBLIB and STEPLIB

JOBLIB

  • This is used to specify where the program that is specified by the EXEC statement resides
  • This statement must immediately follow the JOB statement
  • This statement cannot be used in cataloged procedure
  • It must precede the EXEC statement
  • Example:-

  • //DMJOB JOB (A786),’JUDY’ //JOBLIB DD DSN=MI.TEST.LOADLIB,DISP=SHR // DSN=MI.PROD.LOADLIB,DISP=SHR //STEP1 EXEC PGM=PGM1

    In this example, DMJOB is name of job being submitted. (A786) is accounting information parameter, JUDY is programmer name. Immediately after the JOB statement is JOBLIB DD statement. This is used to specify location of the program that is to be executed, and as shown in above example PGM1 program will be member of MI.TEST.LOADLIB or MI.PROD.LOADLIB. Here sequence of specifying DSN information matters, as JES first will look into MI.TEST.LOADLIB, if load module with name PGM1 found there, it will bypass check in MI.PROD.LOADLIB. So job execution will proceed with load module present in MI.TEST.LOADLIB and in case if PGM1 does not exist there, then it will try to find it in MI.PROD.LOADLIB.

STEPLIB

  • It functions similar to JOBLIB statement, however can be coded after EXEC statement, instead of before it. This statement can be placed anywhere in the job step, and it is not mandatory to specify immediately after EXEC statement
  • This statement is effective only for that job-step
  • This statement can be coded in cataloged procedure
  • Example:-

  • //DMJOB JOB (A786),’JUDY’ //STEP1 EXEC PGM=PGM1 //STEPLIB DD DSN=MI.TEST1.LOADLIB,DISP=SHR

    In this example, DMJOB is name of job being submitted. STEP1 is executing program PGM1. Load module for this program is resides in MI.TEST.LOADLIB

CODING BOTH JOBLIB AND STEPLIB STEMENTS

When both JOBLIB and STEPLIB are coded, then first STEPLIB will be searched for load module, if not found then JOBLIB will be searched for load module and in case load module is not present in libraries specified in STEPLIB and JOBLIB then system libraries are searched for load module. And if load module not found there also, then step will abend with S806. This means STEPLIB overrides JOBLIB, and JOBLIB overrides System libraries.






© copyright mainframebug.com
Privacy Policy