IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to supply called sub-program from test loadlib


IBM Mainframe Forums -> JCL & VSAM
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
dchristensen

New User


Joined: 26 Jul 2006
Posts: 30
Location: Des Moines, Iowa

PostPosted: Wed Sep 14, 2016 11:36 pm
Reply with quote

I have a sub-program I'm trying to test. I have set JOBLIB in the job, and STEPLIB in the step where I execute the program that calls the sub-program. The calling program executes from the test loadlib, but the program continues to get the called sub-program from the production loadlib dataset.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Thu Sep 15, 2016 12:10 am
Reply with quote

You either use STEPLIB in a JOB or you use JOBLIB. You can't use both (or to put it another way, the system won't use both).

Having decided to use one or the other, place your test library ahead of the production library in a concantation:
Code:

//xxxLIB DD DISP=SHR,DSN=testlibrary
//       DD DISP=SHR,DSN=prodlibrary
Back to top
View user's profile Send private message
dchristensen

New User


Joined: 26 Jul 2006
Posts: 30
Location: Des Moines, Iowa

PostPosted: Thu Sep 15, 2016 12:22 am
Reply with quote

Thank you!
I'll give that a try.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 869
Location: The Universe

PostPosted: Thu Sep 15, 2016 12:34 am
Reply with quote

Mr. Christensen didn't tell us if the subroutine is statically linked with the calling program or if it is dynamically linked. There are several solutions to his problem regardless, but we have to know!
Back to top
View user's profile Send private message
dchristensen

New User


Joined: 26 Jul 2006
Posts: 30
Location: Des Moines, Iowa

PostPosted: Thu Sep 15, 2016 12:36 am
Reply with quote

The sub-program is dynamically linked.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Sep 15, 2016 12:42 am
Reply with quote

Bill Woodger wrote:
You either use STEPLIB in a JOB or you use JOBLIB. You can't use both (or to put it another way, the system won't use both).

Having decided to use one or the other, place your test library ahead of the production library in a concantation:

I would like to correct this. We CAN use both STEPLIB and JOBLIB in a JOB.

STEPLIB will be used on the step that has the STEPLIB mentioned. Other steps of the Job will use JOBLIB.

.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Thu Sep 15, 2016 12:53 am
Reply with quote

Perhaps I was unclear:

Quote:
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.


So, although you can have both, for any given step, only one will be used. So you can't have a test module from a test library and the rest from production by using JOBLIB and STEPLIB (which is the task at hand). Only one is relevant for each step.

Note that in the quote, three libraries are being talked about. The "system library" you get for free.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Thu Sep 15, 2016 2:14 am
Reply with quote

Quote:
I have set JOBLIB in the job, and STEPLIB in the step where I execute the program that calls the sub-program.
You must ensure the programs load modules are part of STEPLIB otherwise as said by others JOBLIB will take over and in your case it is production.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2448
Location: Hampshire, UK

PostPosted: Thu Sep 15, 2016 2:24 am
Reply with quote

Quote:
JOBLIB will take over


No, it will not, as quoted above by Bill. If a STEPLIB exists for a step the JOBLIB is ignored TOTALLY for that step.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Thu Sep 15, 2016 9:53 am
Reply with quote

I think, you misunderstand my comment or partially understood or I may not have been clear, if I have a job and has a step which calls the module then steplib will be first preference to look for load module else the joblib for that step.
I think TS has sufficient information to verify so let's see what was the fix
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 869
Location: The Universe

PostPosted: Thu Sep 15, 2016 11:12 am
Reply with quote

JCL Reference manual -
Quote:
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.

Something like this should work -
Code:
//JOBLIB   DD  DISP=SHR,DSN=first-library
//         DD  DISP=SHR,DSN=next-library
//         DD  DISP=SHR,DSN=last-library
//xxx     EXEC PGM=program to test
//STEPLIB  DD  DISP=SHR,DSN=library containing new version of module
//         DD  DISP=SHR,DSN=first-library  libraries in
//         DD  DISP=SHR,DSN=next-library    the JOBLIB
//         DD  DISP=SHR,DSN=last-library
Just to be sure, in words, for the step testing the new module, prepare a STEPLIB DD statement that specifies the library containing the module you want to test followed by additional DD statements that reflect the libraries in the JOBLIB DD statement.

HTH
Back to top
View user's profile Send private message
dchristensen

New User


Joined: 26 Jul 2006
Posts: 30
Location: Des Moines, Iowa

PostPosted: Thu Sep 15, 2016 6:28 pm
Reply with quote

I implemented the joblib first, then dropped the step lib. That still caused the program to call the production version of the sub-program. I next re-implemented the steplib as shown:

Code:

//JOBLIB   DD DSN=SYS5.TESTLIB,DISP=SHR
//         DD DSN=SYS4.STAGING,DISP=SHR
//*


Plus implementing the STEPLIB in the PROC as:
Code:

//P474O200 PROC
//STEPO200 EXEC PGM=S474O200
//STEPLIB  DD DSN=SYS5.TESTLIB,DISP=SHR
//         DD DSN=SYS4.STAGING,DISP=SHR
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Sep 15, 2016 6:47 pm
Reply with quote

Quote:
I next re-implemented the steplib as shown:
And what was the result?
Back to top
View user's profile Send private message
dchristensen

New User


Joined: 26 Jul 2006
Posts: 30
Location: Des Moines, Iowa

PostPosted: Thu Sep 15, 2016 7:32 pm
Reply with quote

I am still pulling the sub-program from the production loadlib.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 869
Location: The Universe

PostPosted: Thu Sep 15, 2016 7:37 pm
Reply with quote

Code:
//JOBLIB   DD DSN=SYS5.TESTLIB,DISP=SHR
//         DD DSN=SYS4.STAGING,DISP=SHR
//*
//P474O200 PROC
//STEPO200 EXEC PGM=S474O200
//STEPLIB  DD DSN=SYS5.TESTLIB,DISP=SHR
//         DD DSN=SYS4.STAGING,DISP=SHR

Since the JOBLIB and STEPLIB appear to be identical, the run may not be testing anything. Perhaps this is closer to what you want -
Code:
//JOBLIB   DD DSN=SYS4.STAGING,DISP=SHR
//*
//P474O200 PROC
//STEPO200 EXEC PGM=S474O200
//STEPLIB  DD DSN=SYS5.TESTLIB,DISP=SHR
//         DD DSN=SYS4.STAGING,DISP=SHR


HTH
Back to top
View user's profile Send private message
dchristensen

New User


Joined: 26 Jul 2006
Posts: 30
Location: Des Moines, Iowa

PostPosted: Thu Sep 15, 2016 7:46 pm
Reply with quote

Okay. I'll test that version.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Sep 15, 2016 7:50 pm
Reply with quote

dchristensen wrote:
I am still pulling the sub-program from the production loadlib.

That would mean you don't have a load for your sub program in your TESTLIB.

Moreover, how do you know that the load for sub-program is from Production?

May be, you are not looking/checking at right place.

.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8569
Location: Dubuque, Iowa, USA

PostPosted: Thu Sep 15, 2016 8:02 pm
Reply with quote

Have you talked to your site support group? They are the ones who best know your environment and they are the ones who should be guiding you on how to access your test program.
Back to top
View user's profile Send private message
dchristensen

New User


Joined: 26 Jul 2006
Posts: 30
Location: Des Moines, Iowa

PostPosted: Thu Sep 15, 2016 8:29 pm
Reply with quote

I learned that the program was statically linked. After adding the DYNAM compiler option, the program then correctly pulled the test sub-program from the SYS5.TESTLIB.

Thanks to all for your time and comments.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Thu Sep 15, 2016 9:37 pm
Reply with quote

Quote:
I learned that the program was statically linked. After adding the DYNAM compiler option, the program then correctly pulled the test sub-program from the SYS5.TESTLIB.
You mislead us when Mr teve-myers asked at first place but glad you found out and worked.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Thu Sep 15, 2016 9:43 pm
Reply with quote

If the sub-program is currently used in Production as a statically-linked program, it is not a good idea to test it by using dynamic CALLs.

To test a statically-CALLed sub-program (which is CALL literal, and compiler option NODYNAM) then you INCLUDE (or "autolink") your member from your test library, again ensuring that it is "higher" on the concatenation (if any) from your Production library.
Back to top
View user's profile Send private message
Kerry Ropar

New User


Joined: 14 Sep 2016
Posts: 25
Location: Australia

PostPosted: Fri Sep 16, 2016 8:06 am
Reply with quote

Well, this query may be totally irrelevant to this post (and might be invalid as well), but if my module is statically linked but I use IS INITIAL with prog-id, then can someone please help me understand what goes behind the curtain?

It should not be re-linking is what I understand (may be wrong), but how does system ensures that a new version is being picked up for working storage but not load-module?
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Sep 16, 2016 9:03 am
Reply with quote

Quote:
how does system ensures that a new version is being picked up for working storage but not load-module?

A new version is Not picked up. It's still the same copy of the program. Only the working storage variables are initialized.

A statically linked sub-program already resides in storage when a call is made. If you call that sub-program again then it's the same copy of the program and it already has the working storage variables values populated in previous call. The working storage values are retained. If you use IS INITIAL then, those values are initialized but it's still the same copy of the program. All of this is true within the same run unit.

Dynamically linked sub-programs get loaded into storage when the first call is made. After that it's same about working storage variables and IS INITIAL.

.
Back to top
View user's profile Send private message
Kerry Ropar

New User


Joined: 14 Sep 2016
Posts: 25
Location: Australia

PostPosted: Fri Sep 16, 2016 11:58 am
Reply with quote

Quote:
A new version is Not picked up. It's still the same copy of the program. Only the working storage variables are initialized.


Yes RahulG31, I agree and that is what I meant as well. I referred to working-storage only, and not to reload of new copy of program. May be my statement was not that clear.

I was under an impression that working-storage variables are dumped (somehow? somewhere?) and re-defined (if I can use this term to signify what I mean) but your statement:

Quote:
If you use IS INITIAL then, those values are initialized


helped me understand that they are only initialized. Thank you for helping me understand.
Back to top
View user's profile Send private message
Kerry Ropar

New User


Joined: 14 Sep 2016
Posts: 25
Location: Australia

PostPosted: Fri Sep 16, 2016 11:59 am
Reply with quote

Additional thank you RahulG31 since I have used quotes for the first time while replying. New learning and practically performed. Looking forward to post (probably answer someone, if I can) with coded as well ..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Passing a field name to COBOL program COBOL Programming 10
This topic is locked: you cannot edit posts or make replies. Sample CICS Webservices Program CICS 1
No new posts Calling Rexx program from Cobol CLIST & REXX 12
No new posts How to define transaction that trigge... CICS 2
No new posts Call Natural program with rexx CLIST & REXX 2
Search our Forums:

Back to Top