Example:
/* This is the main REXX program */
j=1; z.1='a'
call toft
sayjkm /*Displays "1 7 M" */
exit
/* This is a subroutine */
toft: procedure exposejkz.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 Jwould 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='jkm'
call test
exit
/* This is a subroutine */
test: procedure expose (a) /* Exposes A, J, K, and M */
sayajkm /*Displays "jkm169" */
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
saycdef /*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