IBM SC34-5764-01 User Manual
Page 178

Example:
/* This is the main REXX program */
j=1; z.1='a'
call toft
say j k m
/* Displays "1 7 M"
*/
exit
/* This is a subroutine
*/
toft: procedure expose j k z.j
say j k z.j
/* Displays "1 K a"
*/
k=7; m=3
/* Note: M is not exposed
*/
return
Note that if Z.J in the EXPOSE list had been placed before J, the caller's value of J would not have been
visible at that time, so Z.1 would not have been exposed.
The variables in a subsidiary list are also exposed from left to right.
Example:
/* This is the main REXX program */
j=1;k=6;m=9
a ='j k m'
call test
exit
/* This is a subroutine
*/
test: procedure expose (a)
/* Exposes A, J, K, and M
*/
say a j k m
/* Displays "j k m 1 6 9"
*/
return
You can use subsidiary lists to more easily expose a number of variables at one time or, with the VALUE
built-in function, to manipulate dynamically named variables.
Example:
/* This is the main REXX program */
c=11; d=12; e=13
Showlist='c d'
/* but not E
*/
call Playvars
say c d e f
/* Displays "11 New 13 9" */
exit
/* This is a subroutine
*/
Playvars: procedure expose (showlist) f
say word(showlist,2)
/* Displays "d"
*/
say value(word(showlist,2),'New') /* Displays "12" and sets new value */
say value(word(showlist,2))
/* Displays "New"
*/
e=8
/* E is not exposed
*/
f=9
/* F was explicitly exposed
*/
return
Specifying a stem as name exposes this stem and all possible compound variables whose names begin
with that stem. (See page 123 for information about stems.)
PROCEDURE
156
CICS TS for VSE/ESA: REXX Guide