Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values from External Routines

Status
Not open for further replies.

LouPelagalli

Programmer
Sep 24, 2001
6
US
Hi,

Rexx1 calls Rexx2 passing a couple of parameters, using "call rexx2 p1 p2".

Rexx2 does 'arg p1 p2', does some number crunching and exits using "exit p2" p2 = 8 in this case.

But Rexx1 checks p2 and it's blank.

What am I missing here? I'd like Rexx1 to recognize p2 = 8 and carry on.

Thanks,

Lou
 
Hi,

you might want to try some surt of a function call:

rexx1:
...
p2 = rexx2(p1,p2)
...

rexx2:

parse arg p1,p2
...
return p2

good luck...
 
hi,

if you work on mainframe, forget rexx to handle informations between programs - use ispf-services:

/* RX1 */
junk = "Hello 3 548 worst 78 hell"
A = word(junk,random(1,words(junk))
B = word(junk,random(1,words(junk))
address ispexec "vput (a b)"
call rx2
address ispexec "vget (a b)"
say "A:" a
say "B:" b
exit

/* RX2 */
address ispexec "vget (a b)"
if datatype(a) = "NUM" then a=a*a
else a = "ADDED by RX2"
b= /* B is NULL */
address ispexec "vput (a b)"
exit

you can use also the data stack to communicate (see for NEWSTACK/DELSTACK..), but vget/vput is nicer

need more??
ServiceProfessional@web.de
 
Lou,
If you are NOT working on the mainframe, REXX [at least IBM's Object Rexx] uses the reserved variable RESULT to store the return value, if any. In your example, you could do something like this:
...
call rexx2 p1 p2;
answer = RESULT;
say "Is "||answer||" what you expected?"

This should be the equivalent of the function notation neildlb suggested.
Tom
 
Instead of looking in P2, look in RC

RC is a reserved variable for a return code. You can copy RC into P2 then continue your processing
 
Hi Lou,

may be I'm late but I saw this just in time

/* call as function */
IF rexx2(x,y) > 0 then /* seems like an error */

/* call as subroutine */
CALL rexx2 x y
IF result > 0 then /* seems like an error */

/* call as command */
"%rexx2" x y
or
address ispexec "select cmd(rexx2 &x &y)"
if RC > 0 then /* seems like an error */

/* REXX * this is rexx2 */
parse source . type .
if type = "FUNCTION" then arg x,y,dummy
else arg x y .
/*do someting */
select
when ? then erg = 4
when ? then erg = 8
when ...
otherwise erg = 0
end
if type = "COMMAND" then exit erg
else return erg
 
REXX call to ASSEMBLER. I am talking about special varaibles. RC works fine.
But RESULT is always blank ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top