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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Stem Variables between Rexx execs 1

Status
Not open for further replies.

Rexxplorer

Programmer
Oct 10, 2002
2
0
0
AU
Hi,

How do you create a stem variable in a rexx module to be used by another rexx module? I tried "call xxx(stem.)" and "stem.=xxx()" but it didn't work. btw, this is in TSO Rexx.

Thanks
 
Here is a trick:

/* rexx procedure */
/* call subroutine with stem */
trace o

stem_size = 10
rc = 0
do i=1 to stem_size
input.i = 'content' i
end
input.0 = stem_size
Say 'input.0 is: ' input.0
Say '*****'; Do i=1 to input.0; Say input.i; End
fc = Subroutine('input.')
If fc /= 0 Then Exit fc
Say '*****'; Do i=1 to input.0; Say input.i; End

EXIT RC

Subroutine:
result = Arg(1)
Return Subroutine_(Arg(1))
Subroutine_: Procedure Expose(result)
Arg stemname
If Substr(Value(stemname),Length(Value(stemname)),1) /= '.'
Then Return 100

Say '***** within subroutine *****'
Do i=1 To Value(stemname||'0')
Say Value(stemname||i)
End
trace i
Do i=1 To Value(stemname||'0')
Interpret stemname||i '= "new content"' i
End

Return 0
 
You can do this for _internal_ subroutines, but not for _external_ subroutines.
 
The whole process isn't as easy as you would think it is. If you want to simply read the variables then it is pretty much a case of passing them to the called (external) subroutine. The problem comes when you want to alter the variables and pass them back to the calling rexx routine.

If you are under ISPF you could do a VPUT and VGET to the profile. I have used this pretty extensively.

If the variavle you want to return is numeric you could use "exit" with the variable as the return code...again I have used this for things like record counts etc.

A temporary dataset would work too for passing altered stuff back to the caller.

Just a few suggestions you may want to consider. :)

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top