On Fri, 5 Nov 2010 17:20:49 -0700, Gibney, Dave wrote:

>> -----Original Message-----
>> From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
>> Behalf Of Phil Smith
>> Sent: Friday, November 05, 2010 5:09 PM
>> To: IBM-MAIN@bama.ua.edu
>> Subject: Re: Rexx question - Dynamic generation of variables?
>>
>> On Fri, Nov 5, 2010 at 7:57 PM, Gibney, Dave wrote:
>> > And, I can't seem to use a stem value (values of A.x) to index a
>> stem.
>> > A.x = 'foo'
>> > say A.x
>> > B.foo = 'bar'
>> > say B.foo
>> > say B.A.x
>> > y = A.x
>> > say y
>> > say B.y
>> > Gets:
>> > foo
>> > bar
>> > B.A.X
>> > foo
>> > B.foo
>>
>> > I want bar where I get B.A.X and B.foo
>>
First, always, always, always start every EXEC with

    signal on novalue

always.  This will cause your EXEC to abort on any use
of an undefined symbol.  You'll need to quote every string
constant instead of using naked symbols.  At first, you'll
find this a PITA, and stop using it.  Over time, you'll
recognize cases where it would have saved you by detecting
a programming error; sometimes a simple typo, and you'll
return to it.

>Yup value(B.y) gives bar. But value(B.A.x) still gives B.A.X. I suppose
>I can "nest" the value function.
>Whoops, guess not:
>    11 +++ say B.value(A.x)
>IRX0043I Error running TEST, line 11: Routine not found
>
I suggest:

/* Rexx (Untested!) */
signal on novalue
    ...
say value( 'B.'A.x )
say value( B.A.x )

The understanding is left as an exercise for the student.
A special challenge, since I believe an important piece
of documentation is omitted, AFAIK, from all the manuals.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to