View previous topic :: View next topic |
Author |
Message |
Maximus Beginner
Joined: 17 Nov 2005 Posts: 21 Topics: 11
|
Posted: Wed Jan 30, 2008 8:47 am Post subject: How to run external routine dynamically in REXX |
|
|
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 |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed Jan 30, 2008 10:07 am Post subject: |
|
|
Will it work better if you code:
cmd = "%"STARTER_WFL" "DSN
cmd
EXIT |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Jan 30, 2008 11:12 am Post subject: |
|
|
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 .
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 |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed Jan 30, 2008 12:01 pm Post subject: |
|
|
Maybe I'm misunderstanding the O/T. I'm under the impression that "PS5106SW" is another REXX exec or CLIST. |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Jan 30, 2008 2:30 pm Post subject: |
|
|
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 |
|
|
flatearther Beginner
Joined: 19 Apr 2007 Posts: 13 Topics: 2 Location: Bethesda, MD
|
Posted: Thu Jan 31, 2008 3:37 pm Post subject: |
|
|
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 |
|
|
flatearther Beginner
Joined: 19 Apr 2007 Posts: 13 Topics: 2 Location: Bethesda, MD
|
Posted: Thu Jan 31, 2008 4:02 pm Post subject: |
|
|
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 |
|
|
Mickeyd Beginner
Joined: 02 Jan 2003 Posts: 27 Topics: 0
|
Posted: Fri Feb 01, 2008 3:16 pm Post subject: |
|
|
DSN = 'abcdef.abc.PS5106.UBE.U.A11208.B122'
PGM = SUBSTR(DSN,12,06)||'SW'
PGM "'"DSN"'"
EXIT 0 |
|
Back to top |
|
|
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Fri Feb 01, 2008 9:44 pm Post subject: |
|
|
It's difficult to see the difference between single and double quotes in:
PGM "'"DSN"'"
so please use BBCode as in: _________________ ....Terry |
|
Back to top |
|
|
moyeenkhan Beginner
Joined: 04 Dec 2002 Posts: 64 Topics: 21
|
Posted: Sun Feb 03, 2008 11:24 am Post subject: |
|
|
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 |
|
|
|
|