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

Invoking another version from within a program


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
AmritrajKurup

New User


Joined: 15 Aug 2008
Posts: 3
Location: Chicago IL

PostPosted: Mon Aug 18, 2008 10:48 pm
Reply with quote

I have this requirement where I want to invoke a different version of a program based on the parameter value.

Example:
JCL:
//STEP010 EXEC PGM=PROGX,PARM='A'
//STEPLIB DD DSN=NEW.LOADLIB,DISP=SHR

PROGX is a REXX program (compiled and link-edited). If the PARM value is 'A', then the PROGX REXX program should invoke an older version of PROGX located in OLD.LOADLIB. Since the above REXX program executes in a non-TSO address space, I cannot use the TSO CALL statement(CALL statement allows us to specify the full path of a load module). So, I am trying to use the LINKMVS or ATTCHMVS command to invoke the old version of PROGX. However, it looks like we cannot include a load library in the LINKMVS and ATTCHMVS commands. Is there a way to accomplish this thru any other means?

Appreciate your help.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 18, 2008 11:08 pm
Reply with quote

Hello,

Set a return code based on the parm and have 2 steps that conditionally execute - One with the "old" lib and The Other with the current lib specified in the STEPLIB.

Another way to accomplish this is to rename the old one to modnameo while the current module is modname.
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Mon Aug 18, 2008 11:39 pm
Reply with quote

To elaborate on Dick's naming scheme, have the variable 'A' be the suffix of the old progam name. Both old and new in a common STEPLIB.
Code:
//OLD  SET TYPE=A
//STEP1 EXEC PGM=PROGX&TYPE
or set TYPE= to null value to pick new pgm.
Back to top
View user's profile Send private message
AmritrajKurup

New User


Joined: 15 Aug 2008
Posts: 3
Location: Chicago IL

PostPosted: Tue Aug 19, 2008 1:06 am
Reply with quote

Thanks for the quick reply. But I am looking for a way in REXX that will enable me to invoke a program from a specific load library. I think I should have given some details about why I am trying to accomplish this. I have about 3000 batch jobs that use a particular vendor utility. We are trying to develop a wrapper program with the same name as the vendor utility so that we won't have to make any changes to the JCLs. The wrapper program will by default invoke the new utility but should also have the ability to invoke the old vendor utility if a different parm value is passed to it. Please let me know if you have any suggestions.

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

Global Moderator


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

PostPosted: Tue Aug 19, 2008 1:20 am
Reply with quote

Either the new program or the old vendor utility has to be renamed to a unique name. You can concatenate multiple libraries in your STEPLIB or JOBLIB DD statement but the first library to contain the named module is the library used and there's no way that I know of to change this. So using the same name for old and new means the one concatenated after the other one will never be available.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 19, 2008 1:21 am
Reply with quote

Hello,

You could rename the vendor utility and when your wrapper determined tha original version of the module be invoked, invoke the renamed module.

Before doing this with the "real" load module, a copy and some testing would be good. . .
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Tue Aug 19, 2008 2:19 am
Reply with quote

REXX is great, but not always the best tool for the job. I think you could easily do this by calling an assembler routine which:

1. opens vendor library DD name.
2. uses LINK macro specifying program name, with DCB parameter to specify DD name.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 19, 2008 2:27 am
Reply with quote

Hi Pedro,

Quote:
REXX is great, but not always the best tool for the job.
Completely agree.

And have similar feelings about the often over/mis-use of the sort product on a system too. . .

d
Back to top
View user's profile Send private message
AmritrajKurup

New User


Joined: 15 Aug 2008
Posts: 3
Location: Chicago IL

PostPosted: Tue Aug 19, 2008 2:35 am
Reply with quote

Thank you. I will try the Assembler routine approach. Appreciate the quick responses from everyone.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top