In JCL the STEPLIB always overrides the JOBLIB.Can anyone explain why is it so?
-
As @cschneid points out, no-one is going to know the actual answer to this, and if they did, what would it help with anything? A good opportunity to get this question closed. – Bill Woodger Aug 06 '14 at 16:00
3 Answers
The below are excerpts from the IBM manuals and explain what the Joblib DD statement does and how the Steplib DD statement interacts with the Joblib statement.
Use the JOBLIB DD statement to:
Create a private library.
Identify a private library that the system is to search for the program named in each EXEC statement PGM parameter in the job. Only if the system does not find the program in the private library, does it search the system libraries.
Relationship of a STEPLIB to a JOBLIB
Use a JOBLIB DD statement to define a private library that the system is to use for an entire job. If you include a JOBLIB DD statement for the job and a STEPLIB DD statement for an individual job step, the system first searches the step library and then the system library for the program requested in the EXEC statement. The system ignores the JOBLIB library for that step.

- 22,383
- 32
- 112
- 130

- 831
- 1
- 6
- 12
-
1OK, people still prefer this one :-) JOBLIB overrides nothing. JOBLIB provides "private libraries" (one or more) which will be searched first to find a program, before the system libraries. JOBLIB provides those libraries to each step in the JOB. In any step where STEPLIB is provided, JOBLIB, if present, is ignored. The search is then the private libraries from STEPLIB, followed by the system libraries. Neither STEPLIB nor JOBLIB "override the libraries defined by the system". – Bill Woodger Jul 08 '13 at 14:43
-
You are right I misunderstood how Joblib and Steplib relate to each other, it is not what I would have expected. – Deuian Jul 08 '13 at 20:54
In a word, no. For a definitive answer you would have to find the original designers and ask them why; I doubt they remember after half a century. It was a design decision and, rationalizations aside, like most such the reason is likely "It seemed like a good idea at the time."
The documentation for JOBLIB and STEPLIB indicates they serve the same purpose.

- 10,237
- 1
- 28
- 39
-
I think this is correct. There was a choice, someone took one choice over another. Why? Who knows except the chooser? If the other choice had been taken, that choice would now "make sense" as it would have been already used for many years. It is the way it is. – Bill Woodger Jul 08 '13 at 11:42
-
Actually there are many reasons why a STEPLIB might be needed to over-ride a JOBLIB. One of the best reasons is when a proprietary software product is installed that only one application has a license to use. In general though, the JOBLIB is used to define private, or application specific libraries, and on the occasion when you need version control to reference a different version of the object contained in JOBLIB, it would be appropriate to insert the STEPLIB. – MikeC Jul 16 '13 at 20:45
-
1@MikeC these are the rationalizations I spoke of. I am well aware of the *uses* of JOBLIB and STEPLIB, but that wasn't the question. – cschneid Jul 17 '13 at 11:40
Think of this by analogy. You know when you write a program how you can have a local variable that is the same name as a global variable. The scoping rules for languages go from specific to general.
Same with STEPLIB which is specific at the job step level. While JOBLIB is a general, global definition. This allows a general definition or override that is changeable at each step. To go the other way is too rigid and not controllable.
Some will say "well, someone at IBM just made choice." No, I don't agree with that, IBM had good, solid, rational decisions behind how they designed mainframe hardware and software. And the ability to control program libraries in a hierarchical manner, from specific to general is one of their many excellent choices.

- 3,777
- 1
- 15
- 21