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!

How do I return a Stem variable from a procedure?

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
US
Hi,
Rexx is driving me crazy...
I'd like to call a function (procedure, whatever) and have it populate a stem with data, then return that stem.

I'm using TSO/Rexx on z/OS 1.4, and I wrote a sample program to test it and figure out how to get it working before trying to do it in my real script.
Code:
ADDRESS TSO
SIGNAL ON NOVALUE

arr. = ""
arr. = TestArray()
SAY "arr[0]:" arr.0
SAY "arr[1]:" arr.1
SAY "arr[2]:" arr.2
EXIT 0

TestArray: PROCEDURE
   array. = ""
   array.0 = 2
   array.1 = "Hello"
   array.2 = "World"
RETURN array.
When I run it, it just prints:
arr[0]:
arr[1]:
arr[2]:


Is it possible to do what I'm trying to do in Rexx?
 
No. You cannot.
You must eliminate the keyword PROCEDURE, because it does all variables in the procedure local.
Perhaps you should use the REXX stack for that instead of stem variables.

Hope this help you
 
Thanks, I expected as much. :-(
I'll keep PROCEDURE and just EXPOSE the stem.
Bad programming with a bad language...
 

No, simply bad programming. You expect to be able to type letters and numbers on your keyboard and get coherent results without actually understanding what you are typing. That hasn't ever worked, and it still doesn't.

Step #1: RTFM.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Using global variables is definitely bad programming, but a programming language that is so deficient that you have no choice but to use global variables or other bad programming practices is a bad language. [thumbsdown]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top