Tuesday, December 6, 2011

JCL: Testing your understanding of STEPLIB

 Assume I have three load libraries as follows:
     USERID.TSTS.LOADLIB1
     USERID.TSTS.LOADLIB2
     USERID.TSTS.LOADLIB3

  I have got the same program TEST1 in the first two load libraries. For all practical purposes, you may consider the third library to be empty. Now, I had included slightly different display statements in these two versions of the program, so that if I run the program from loadlib1 I get the message:
"I HAVE BEEN EXECUTED FROM LOADLIB # 1"
and if I run it from loadlib2 I get:
"I HAVE BEEN EXECUTED FROM LOADLIB # 2".

   
1. If I have loadlib1 (alone) in the JOBLIB, and loadlib2 (alone) in the STEPLIB, what is the display I get?


Answer:   "I HAVE BEEN EXECUTED FROM LOADLIB # 2".
 Reason:    STEPLIB takes precedence over JOBLIB when searching for a program.

2. If I concatenate loadlib1 and loadlib2 (in that order) in JOBLIB and have loadlib3 (alone) in STEPLIB, what display do I get?


 Answer:   - Nothing - (Since no load module found for TEST1)
  Reason:   The first reason applies here too. But since loadlib3 is empty, the search continues next in System Program Library (SYS1.LINKLIB), skips JOBLIB.


3. If I have loadlib2 (alone) in JOBLIB and concatenate loadlib3 and loadlib1 (in that order) in         STEPLIB, what display do I get?
  Answer:   "I HAVE BEEN EXECUTED FROM LOADLIB # 1".
  Reason:   Since loadlib3 and loadlib1 are concatenated, the search continues in loadlib1 (as loadlib3 is found empty). STEPLIB statement tells the system to look for programs in libraries specified there in the order given. If not found, searches in System Program Library.


The program search order uses the following program libraries in the order given:
                                                               
    1) JOB Pack Area (already loaded programs)                 
    2) Private task library, if specified.                     
    3) STEPLIB library, if specified.                          
    4) JOBLIB library, if specified, AND no STEPLIB is specified
    5) Link Pack Area (PLPA)                                   
    6) System Link List (i.e., SYS1.LINKLIB and the data sets  
       concatenated to it).                                    

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.