SCOUG-Programming Mailing List Archives
Return to [ 15 |
November |
1998 ]
>> Next Message >>
Content Type: text/plain
Anybody know how to pass stem variables to procedures in Rexx?
I know I can use the "expose" option on the "procedure" statement:
suba: procedure expose S.
...
return
but I'm writing a library routine so I won't know what the stem
variable's name is.
I know I can use an expose list:
global = 'A.'
...
suba: procedure expose (global)
but I'd like to pass the stem variable directly if I can so the calling
application doesn't have to code the expose list (and I still wouldn't
know the stem's name).
The following test code doesn't work, and I'd like it to.
- Peter Skye
/* REXX - How do you pass stem variables as parameters? */
/* 1. Initialize a stem variable. */
A.1 = 'Line 1'
A.2 = 'Line 2'
A.3 = 'Line 3'
/* 2. Show what's in it. */
do index = 1 to 3
say '2-' A.index
end /* I indent my "end" statements. :) */
/* 3. Now call a procedure and see if you can display and modify the
values. */
call stemvar A. /* Note I'm calling with "A.", not "A". "A" fails too.
*/
/* 4. Show what's in it after returning. */
do index = 1 to 3
say '4-' A.index
end
/* 5. Now call a function and see if you can display, modify and return
the values. */
say '5a-' stemfunc(A.) /* "stemfunc()" returns a value. */
/* 6. Show what's in the stem variable now. */
do index = 1 to 3
say '6-' A.index
end
exit
/* SUBROUTINES FOLLOW */
stemvar: procedure
say "3- In StemVar ..."
say '3-' arg(1).1
arg(1).2 = 'New line 2'
say "3-' Exiting ..."
return arg(1).
stemfunc: procedure
say "5- In StemFunc ..."
say '5-' arg(1).2
arg(1).2 = "Hello, World"
say "5- Exiting ..."
return arg(1).2
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".
For problems, contact the list owner at
"rollin@scoug.com".
=====================================================
>> Next Message >>
Return to [ 15 |
November |
1998 ]
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|