MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to run external routine dynamically in REXX

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Maximus
Beginner


Joined: 17 Nov 2005
Posts: 21
Topics: 11

PostPosted: Wed Jan 30, 2008 8:47 am    Post subject: How to run external routine dynamically in REXX Reply with quote

Hello,
I need to call external rexx program/external rexx routine from a rexx program. External routine is defined by dyanamically populating the variable in the calling routine. For eg

DSN = 'abcdef.abc.PS5106.UBE.U.A11208.B122'

PGM_NAME = SUBSTR(DSN,12,6)

STARTER_WFL = PGM_NAME || 'SW'

DSN = "'"DSN"'"

"CALL "STARTER_WFL" "DSN""

EXIT


While Executing this code I am getting this as message
DATA SET PS5106SW.LOAD NOT IN CATALOG OR CATALOG CAN NOT BE ACCESSED
MISSING DATA SET NAME+
MISSING DSNAME (MEMBER NAME)


But If we are hard coding the external calling routine, it is executing fine.
for say CALL PS5106SW DSN

Please suggest me that how to call dynamically.

Thanks

Maximus
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Jan 30, 2008 10:07 am    Post subject: Reply with quote

Will it work better if you code:

cmd = "%"STARTER_WFL" "DSN
cmd
EXIT
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Jan 30, 2008 11:12 am    Post subject: Reply with quote

the TSO command CALL requires the full data set name as in:
Code:
CALL 'FRED.WILMA.BETTY(BARNEY)'
or if the module is in the standard search order a *() syntax such as
Code:
CALL *(BAMBAM)
.

so you might try
Code:
"CALL *(" || starter_wfl || ') ' || dsn
or similar.

if you are using ISPF services for anything else, you might also look at ISPF's SELECT service. I forget offhand if it should be PGM() or CMD() but I think it is PGM in this case because of the way parameters are passed.
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Jan 30, 2008 12:01 pm    Post subject: Reply with quote

Maybe I'm misunderstanding the O/T. I'm under the impression that "PS5106SW" is another REXX exec or CLIST.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Jan 30, 2008 2:30 pm    Post subject: Reply with quote

I assumed that because CALL is in quotes, it is the CALL command which only calls load modules. For Rexx and CLIST it would be EXEC and for Rexx functions, even if they are implemented as load modules, it would be the built in rexx Call statement without quotes or an implicit call, eg PS5106SW()
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
flatearther
Beginner


Joined: 19 Apr 2007
Posts: 13
Topics: 2
Location: Bethesda, MD

PostPosted: Thu Jan 31, 2008 3:37 pm    Post subject: Reply with quote

I may be missing the point, but I have a rexx "driver" that dynamically calls other rexx execs by doing the following :

(populate the runExec variable with the name of the rexx exec you want to run)

Interpret "Call " runExec
Back to top
View user's profile Send private message
flatearther
Beginner


Joined: 19 Apr 2007
Posts: 13
Topics: 2
Location: Bethesda, MD

PostPosted: Thu Jan 31, 2008 4:02 pm    Post subject: Reply with quote

So instead of your line "CALL "STARTER_WFL" "DSN"" ...

... you would code :

Interpret "Call "STARTER_WFL "DSN"

I haven't tried passing a parameter but I think that will work.
Back to top
View user's profile Send private message
Mickeyd
Beginner


Joined: 02 Jan 2003
Posts: 27
Topics: 0

PostPosted: Fri Feb 01, 2008 3:16 pm    Post subject: Reply with quote

DSN = 'abcdef.abc.PS5106.UBE.U.A11208.B122'
PGM = SUBSTR(DSN,12,06)||'SW'

PGM "'"DSN"'"

EXIT 0
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Fri Feb 01, 2008 9:44 pm    Post subject: Reply with quote

It's difficult to see the difference between single and double quotes in:
PGM "'"DSN"'"
so please use BBCode as in:
Code:
PGM "'"DSN"'"

_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
moyeenkhan
Beginner


Joined: 04 Dec 2002
Posts: 64
Topics: 21

PostPosted: Sun Feb 03, 2008 11:24 am    Post subject: Reply with quote

You can call an external routine in two way:-
1. Call MyExternalRoutine Parameters
2. xInfo=MyExternalRoutine(Parameters)

Your External Routine should have ARG paramter to accept Parameters that you pass.
You should pass back the results thru EXIT.

Ex:
MyResult:
/* EXternal Routine */
Arg I J K
OutCome= I * J * K
Exit OutCome

My Program
..................
..................
I=61
J=3
K=4
Call OutCOme I J K
MyResult=Rc

Or
MyResult=OutCome(I J K)



Hope this gives you enough to proceed
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group