ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software

Difference Between JOBLIB and STEPLIB statements in JCL

Updated on May 26, 2014

What is JOBLIB ?

JOBLIB is a data definition statement (DD) at JOB level which contains the load modules of programs which are executed by JOB at different steps.

Note: JOBLIB statement can't be used/coded in cataloged procedures.


Syntax:
Following are the syntax of a JOBLIB statement

Syntax 1:
//JOBLIB DD DSN=Place your PDS here

Syntax 2:

//JOBLIB DD DSN=Place your first PDS here
DD DSN=Place your second PDS here

Explanation of above syntax with example:

Example: Assume that we have a JCL which has 4 steps and is executing 4 different programs. If the load modules of all four programs are contained in a single PDS then we would use the first syntax where in only one PDS name is supplied at JOBLIB statement.

If the load modules of all four programs are contained in a two different PDS then we would use the second syntax where in two PDS names are supplied at JOBLIB statement. At the time of program execution load module of program is searched in first PDS, if not found then searched in second PDS.

Example 1: Example JCL code which executes 4 programs. Load modules all four programs are contained in a single PDS

//TESTJOB1 JOB (ACCINFO),user_id,CLASS=D,MSGCLASS=0,REGION=OM 
//********************************************************** 
//JOBLIB   DD  DSN=TEST.PGMS.LOAD,DISP=SHR
//********************************************************** 
//STEP01  EXEC PGM=PGM1 
//SYSOUT    DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//********************************************************** 
//STEP02  EXEC PGM=PGM2 
//SYSOUT    DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//**********************************************************
//STEP03  EXEC PGM=PGM3 
//SYSOUT    DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//**********************************************************
//STEP04  EXEC PGM=PGM4 
//SYSOUT    DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//**********************************************************
//

Image shows the above code in mainframe screen

Example JCL with JOBLIB statement (Single library)
Example JCL with JOBLIB statement (Single library)

Explanation of the above code

In the above code load modules of all the four programs PGM1, PGM2, PGM3, PGM4 are picked from a JOBLIB library "TEST.PGMS.LOAD".

Example 2: Example JCL code which executes 4 programs. All the load modules are not contained in a single PDS

//TESTJOB1 JOB (ACCINFO),user_id,CLASS=D,MSGCLASS=0,REGION=OM 
//********************************************************** 
//JOBLIB   DD  DSN=TEST.PGMS.LOAD1,DISP=SHR
//         DD  DSN=TEST.PGMS.LOAD2,DISP=SHR 
//         DD  DSN=TEST.PGMS.LOAD3,DISP=SHR 
//         DD  DSN=TEST.PGMS.LOAD4,DISP=SHR 
//********************************************************** 
//STEP01  EXEC PGM=PGM1 
//SYSOUT    DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//********************************************************** 
//STEP02  EXEC PGM=PGM2 
//SYSOUT    DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//**********************************************************
//STEP03  EXEC PGM=PGM3 
//SYSOUT    DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//**********************************************************
//STEP04  EXEC PGM=PGM4 
//SYSOUT    DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//**********************************************************
//
Example JCL with JOBLIB statement (Four different libraries)
Example JCL with JOBLIB statement (Four different libraries)

Explanation of the above code

In the above code at the time of execution of program PGM1 load module of PGM1 is initially searched in first PDS "TEST.PGMS.LOAD2". If the load module is found then program will continue with the execution. If the load module is not found in first PDS then searched in second PDS "TEST.PGMS.LOAD2”... Etc

The above process is done for all the four programs.

What is STEPLIB ?

STEPLIB is data definition statement at step level which contains the load modules of programs. STEPLIB is coded immediately after the JOB Step.

Partition datasets mentioned at STEPLIB are applicable only to that step not for the entire job. In other words load module of the program which is executed at a particular step is searched in the partition datasets coded in STEPLIB of that particular step.

Note: Unlike JOBLIB, STEPLIB can be coded in cataloged procedures.

Syntax:
Following is the syntax of a STEPLIB statement

Syntax 1:
//STEPLIB DD DSN=Place your PDS here

Syntax 2:
//STEPLIB DD DSN=Place your first PDS here
DD DSN=Place your second PDS here

Explanation of above syntax with example:

Example: Assume that we have a program (Program1) which calls Program2 and is executed at step1 of the JCL.

a) If the load modules of both the programs (program1, program2) are placed in a single PDS then we would use the first syntax, wherein only one PDS name is supplied at STEPLIB statement.


b) If the load modules of both the programs are present in two different PDS then we would use second syntax, where in two PDS names are supplied at STEPLIB statement.

Example JCLs using STEPLIB statement

The following are the example JCL codes which shows the use of STEPLIB statement

Example1: JCL code which executes 2 programs at two steps and step lib is coded at all the two steps. No JOBLIB is present

//TESTJOB1 JOB (ACCINFO),user_id,CLASS=D,MSGCLASS=0,REGION=OM 
//********************************************************** 
//STEP01  EXEC PGM=PGM1 
//STEPLIB  DD  DSN=TEST.PGMS.LOAD1,DISP=SHR
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//********************************************************** 
//STEP02  EXEC PGM=PGM2 
//STEPLIB  DD  DSN=TEST.PGMS.LOAD2,DISP=SHR
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//
Example JCL with STEPLIB statement for two different steps
Example JCL with STEPLIB statement for two different steps

Explanation of the above code

In the above example load module of program "PGM1" is searched in STELIB library "TEST.PGMS.LOAD1" of STEP01.

if the load module is not found in steplib library "TEST.PGMS.LOAD1" then program will abend with abed code "S806" (Load module not found).


Load module of program "PGM2" is searched in STELIB library "TEST.PGMS.LOAD2" of STEP02.

If the load module is not found in steplib library "TEST.PGMS.LOAD2" then program will abend with abed code "S806" (Load module not found).

Example 2: JCL code which executes 2 programs at two steps and step lib is coded for only one step

//TESTJOB1 JOB (ACCINFO),user_id,CLASS=D,MSGCLASS=0,REGION=OM 
//********************************************************** 
//JOBLIB  DD  DSN=TEST.PGMS.LOAD2,DISP=SHR
//        DD  DSN=TEST.PGMS.LOAD1,DISP=SHR
//STEP01  EXEC PGM=PGM1 
//STEPLIB  DD  DSN=TEST.PGMS.LOAD1,DISP=SHR
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//********************************************************** 
//STEP02  EXEC PGM=PGM2 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//
Example JCL with STEPLIB and JOB statements
Example JCL with STEPLIB and JOB statements

Explanation of the above code

In the above example load module of program "PGM1" is searched in STELIB library "TEST.PGMS.LOAD1" of STEP01.

If the load module is not found in STEPLIB library "TEST.PGMS.LOAD1" then program will abend with ABEND code "S806" (Load module not found). JOBLIB statement is ignored when the STEPLIB is coded

Since no STEPLIB is coded for step STEP02, load module of program "PGM2" is searched in JOBLIB libraries "TEST.PGMS.LOAD1", "TEST.PGMS.LOAD2”. If the load module is not found in these two libraries then job will ABEND with S806 "load module not found" error.


Note:
If both STEPLIB and JOBLIB are coded, then STEPLIB specification will override JOBLIB specification.

Difference between JOBLIB and STEPLIB

JOBLIB
STELIB
JOBLIB is JOB level DD statement
STEPLIB is a step level DD statement
JOBLIB is coded immediately after the JOB statement
STEPLIB is coded immediately after the STEP Exec statement
JOBLIB statement can't be used/coded in cataloged procedures
STEPLIB can be coded inside cataloged procedures
JOBLIB statement is ignored if both JOBLIB and STEPLIB are specified
STEPLIB will override the JOBLIB, if both JOBLIB and STEPLIB are specified

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: "https://hubpages.com/privacy-policy#gdpr"

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)