OK, this may be a bit weird. I've been enhancing a z/OS HTTP based web site
which I originally wrote. As an aside, it does some RACF work. Anyway, the
enhanced site uses a _lot_ of JavaScript in the browser. And it invokes a
number of CGIs, using AJAX, which are written in REXX to get information. I
have just gotten into the IRRXUTIL REXX program to do some of the RACF
information extraction. This replaces doing an ADDRESS TSO "LU user" type
command and parsing the results. IRRXUTIL returns its information in a REXX
stem variable. What I'm thinking of doing is writing an HLASM function
which is passed the name of the stem variable and returns a JSON encoded
string with the same information. I can then easily pass that back to the
JavaScript routine which can do a JSON.parse on the string to create a
JavaScript variable with all the information easily accessible.

I'm curious if others think this would be generally useful. I guess what
I'm basically asking is how many people write AJAX routines in REXX and
need to pass back complicated information structures which are in REXX stem
variables.

Of course, I haven't yet thought about all the design considerations for
how to form the resulting JSON. Examples:

STEM.0=3
STEM.1=A
STEM.2=B
STEM.3=C

JSON var: { "STEM" : ["A", "B', "C"] } or should it be {"STEM" : { "0":3,
"1" : "A", "2" : "B", "3" : "C" } }

The latter is more the way that REXX works. That is, REXX does not have
arrays, per se. It _emulates_ the concept of an array by using stem
variables.

Questions: If I decide on making the above an array: What if STEM.2 doesn't
exist? What if STEM.100 exists?
Should I use format #1 if and only if there exists an element with a name
of "0" which is a numeric value and there also exists a ".n" for all values
from 1 to the value in .0. What about if there is a ".m" where "m" is a
number outside the range 1..n? Use format #2? Report an error? What about a
".m" where "m" is not numeric? E.g.

STEM.0=3
STEM.1=A
STEM.2=B
STEM.3=C
A="A" /* JUST TO BE SURE */
STEM.A='BUBBA'

Even worse, as above, but also

STEM.A.0=1
STEM.A.1="FETT"

I need to find an aspirin now. I'm almost convinced that I will need some
really "fancy" way to do this, if I want to try to accept all valid REXX
stem variable possibilities.

-- 
This is a test of the Emergency Broadcast System. If this had been an
actual emergency, do you really think we'd stick around to tell you?

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to