Rexx vars are always upper-cased *except* for 'content addressable arrays'
(stemmed variables). For example:
name='Les Koehler'
city.name='Tampa'
say 'Enter the name of the person and I''ll give you the city'
parse pull who
say city.name
The concept is simple yet very powerful. I used it once to improve the elapsed
time of matching a vendors individual transaction accounting records against his
end of month accounting records from hours to a couple of minutes. The
individual records and the monthly records did *not* have the same layout, but
with this technique it was a snap to match them.
Les
Steve Marak wrote:
I have one of those "is there ever any situation when ... would not be a
good default" questions, and I need the help of VM-savvy minds capable of
perverse and twisted logic. I can't imagine a better place to find them
than this list. (Yes, that was intended as a compliment.)
As you all know, DMSCGR and DMSCSR are CSL routines which retrieve and
set, respectively, the values of REXX variables. The default behavior is
that the variable name passed is searched for directly in REXX's list of
variables, exactly as passed. Optionally, the caller can ask that the name
be both translated to upper case and that REXX perform variable name
substitution on it before looking for it.
(Since REXX doesn't care about case in variable names and some quick
experiments confirm that passing mixed- or lower-case names without this
option isn't productive [except of non-zero return codes], one could
reasonably ask why the name is not always translated to upper-case. I
think it's a very valid question, but more or less irrelevant to my
problem.)
In situations where everyone involved knows which behavior is desired, the
choice between substitution or not isn't an issue. But if there's a
situation where an end user will create REXX execs which pass a variable
name to a program which will then retrieve or set it via these routines,
it's more problematic ... or maybe not, if one or the other behavior is
obviously preferable.
Can anyone think of a situation in which you would *not* want substitution
performed on the variable name passed? Typically, the whole reason you use
compound REXX variables is to get that. But the writers of these routines
didn't make that the default, so I want to know if there's some obvious
situation we're missing where you wouldn't want it. (We've come up with
one exotic case involving REXXVARS, but it's not one that seems likely to
occur. In fact, it seems like the writer of the exec would almost have to
be out to get you to code it that way.)
Thanks,
Steve
-- Steve Marak
-- sama...@gizmoworks.com