Discussion:
strange rexx stem error
(too old to reply)
Itschak Mugzach
2016-07-17 07:48:36 UTC
Permalink
Raw Message
I
​ have two variables, xName and xValue. running the following code, I can't
recall the values and the Say statement returns just the stem name (assume
name is james and value is peterson: ​


​Do i = 1 to 9
Parse var xxx xname xvalue xxx
​xarray.i = xname
xarray.xname = xvalue
End
Say xarray.james /* Returens xarray.james */
xname = xarray.i
Say xarray.xname /* returns the correct value, peterson */


​Any idea why?​

*| **Itschak Mugzach | Director | SecuriTeam Software | *

*|* *Email**: ***@securiteam.co.il **|* *Mob**: +972 522 986404 **|*
*Skype**: ItschakMugzach **|* *Web**: www.Securiteam.co.il **|*

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
christel.u.w.pachl christel.u.w.pachl
2016-07-17 08:15:35 UTC
Permalink
Raw Message
The variable James (used in xarray.James) has no value assigned

Try

z='james'
Say xarray.z

Greetings from Vienna

Walter
Post by Itschak Mugzach
I
have two variables, xName and xValue. running the following code, I can't
recall the values and the Say statement returns just the stem name (assume
Do i = 1 to 9
Parse var xxx xname xvalue xxx
xarray.i = xname
xarray.xname = xvalue
End
Say xarray.james /* Returens xarray.james */
xname = xarray.i
Say xarray.xname /* returns the correct value, peterson */
Any idea why?
*| **Itschak Mugzach | Director | SecuriTeam Software | *
*Skype**: ItschakMugzach **|* *Web**: www.Securiteam.co.il **|*
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Robin
2016-07-17 12:43:39 UTC
Permalink
Raw Message
When variable xxx has a null value (by virtue of the Parse statement) then variable xarray.AnyVariable will assume the value of its name.

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Itschak Mugzach
Sent: July 17, 2016 3:47 AM
To: TSO-***@VM.MARIST.EDU
Subject: [TSO-REXX] strange rexx stem error

I
​ have two variables, xName and xValue. running the following code, I can't recall the values and the Say statement returns just the stem name (assume name is james and value is peterson: ​


​Do i = 1 to 9
Parse var xxx xname xvalue xxx
​xarray.i = xname
xarray.xname = xvalue
End
Say xarray.james /* Returens xarray.james */ xname = xarray.i Say xarray.xname /* returns the correct value, peterson */


​Any idea why?​

*| **Itschak Mugzach | Director | SecuriTeam Software | *

*|* *Email**: ***@securiteam.co.il **|* *Mob**: +972 522 986404 **|*
*Skype**: ItschakMugzach **|* *Web**: www.Securiteam.co.il **|*

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Itschak Mugzach
2016-07-17 13:00:14 UTC
Permalink
Raw Message
Walter, I can't send the code. Too complex and involves parsing of json
received from external source. The stem is initialized (stem. = 0).
Robin, This is why I can't understand why it doesn't work. I wrote hundreds
of programs using this method.

Anyway, I bypassed by looking at the known index (e.g. stem.i that points
to the name).

Best,
ITschak

ITschak Mugzach
Z/OS, ISV Products and Application Security & Risk Assessments Professional
Post by Robin
When variable xxx has a null value (by virtue of the Parse statement) then
variable xarray.AnyVariable will assume the value of its name.
-----Original Message-----
Sent: July 17, 2016 3:47 AM
Subject: [TSO-REXX] strange rexx stem error
I
​ have two variables, xName and xValue. running the following code, I
can't recall the values and the Say statement returns just the stem name
(assume name is james and value is peterson: ​
​Do i = 1 to 9
Parse var xxx xname xvalue xxx
​xarray.i = xname
xarray.xname = xvalue
End
Say xarray.james /* Returens xarray.james */ xname = xarray.i Say
xarray.xname /* returns the correct value, peterson */
​Any idea why?​
*| **Itschak Mugzach | Director | SecuriTeam Software | *
*Skype**: ItschakMugzach **|* *Web**: www.Securiteam.co.il **|*
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
christel.u.w.pachl christel.u.w.pachl
2016-07-17 13:07:49 UTC
Permalink
Raw Message
Robin,

I think you are mistaken...

a.=3
z=''
a.z=4
Say 'a. =' a.
Say 'a.z=' a.z
Say 'a.1=' a.1
Say 'a.4=' a.4

G:\>rexx arra
a. = 3
a.z= 4
a.1= 3
a.4= 3

t='james'
stem.t='xxx'
Say stem.james
t='JAMES'
stem.t='james'
Say stem.james lele

james, in the last line has the value JAMES ans so accesses the correct compound
variable

Trace I helps in such a case

Walter
Post by Robin
When variable xxx has a null value (by virtue of the Parse statement) then
variable xarray.AnyVariable will assume the value of its name.
-----Original Message-----
Of Itschak Mugzach
Sent: July 17, 2016 3:47 AM
Subject: [TSO-REXX] strange rexx stem error
I
have two variables, xName and xValue. running the following code, I can't
recall the values and the Say statement returns just the stem name (assume
Do i = 1 to 9
Parse var xxx xname xvalue xxx
xarray.i = xname
xarray.xname = xvalue
End
Say xarray.james /* Returens xarray.james */ xname = xarray.i Say
xarray.xname /* returns the correct value, peterson */
Any idea why?
*| **Itschak Mugzach | Director | SecuriTeam Software | *
*Skype**: ItschakMugzach **|* *Web**: www.Securiteam.co.il **|*
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Paul Gilmartin
2016-07-17 23:06:48 UTC
Permalink
Raw Message
Post by Itschak Mugzach
I
​ have two variables, xName and xValue. running the following code, I can't
recall the values and the Say statement returns just the stem name (assume
name is james and value is peterson: ​
​Do i = 1 to 9
Parse var xxx xname xvalue xxx
​xarray.i = xname
xarray.xname = xvalue
End
Say xarray.james /* Returens xarray.james */
I'm surprised; I'd expect: XARRAY.JAMES
Post by Itschak Mugzach
xname = xarray.i
Say xarray.xname /* returns the correct value, peterson */
For enlightment, try:
say james xarry.james i xarray.i

I detest case insensitivity!

Always best to start your Rexx code with
signal on novalue

It detects many errors such as this.

-- gil

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
christel.u.w.pachl christel.u.w.pachl
2016-07-18 07:18:50 UTC
Permalink
Raw Message
say james xarry.james i xarray.i
I detest case insensitivity!
As for me, I love :-)

May I remind you of the one Thing I detest about Signal On Novalue (which I
LOVE)

It does not detect unassigned variables in tails od compound variables:

a.=0
say a.name
Say b.name
Signal On Novalue
c.=0
Say c.name /* NOVALUE is here not detected (on name) */
Say d.name

Novalue:
Say 'Novalue raised in line' sigl
Say sourceline(sigl)
Say 'Variable' condition('D')
Say 'You can look around now.'
Trace ?R
Nop


E:\>rexx nov
0
B.NAME
0
Novalue raised in line 7
Say d.name
Variable D.NAME
You can look around now.
+++ "WindowsNT COMMAND E:\nov.rex"
15 *-* Nop
+++ Interactive trace. “Trace Off” to end debug,

AND it should have made the Default

But then Say Hello world would not have worked.

End of Lamento

Walter

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Pedro Vera
2016-07-18 16:28:39 UTC
Permalink
Raw Message
It works correctly when xname is uppercased:

/* rexx */
xxx = 'James Peterson Ben Franklin'
Do i = 1 to 2
Parse var xxx xname xvalue xxx
xname = translate(xname)
say 'xname('xname')'
xarray.i = xname
xarray.xname = xvalue
End
Say 'xarray.james' xarray.james /* returns the correct value, peterson */
xname = xarray.1
Say 'xarray.xname' xarray.xname /* returns the correct value, peterson */





Pedro Vera
DB2 Admin Tool
http://www-01.ibm.com/software/data/db2imstools/db2tools/db2admin/

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Karlheinz Wittemann
2016-07-18 16:50:42 UTC
Permalink
Raw Message
If you use the item of a variable to bild a stem, its case-sensitive.

Heinz
Post by Pedro Vera
/* rexx */
xxx = 'James Peterson Ben Franklin'
Do i = 1 to 2
Parse var xxx xname xvalue xxx
xname = translate(xname)
say 'xname('xname')'
xarray.i = xname
xarray.xname = xvalue
End
Say 'xarray.james' xarray.james /* returns the correct value, peterson */
xname = xarray.1
Say 'xarray.xname' xarray.xname /* returns the correct value, peterson */
Pedro Vera
DB2 Admin Tool
http://www-01.ibm.com/software/data/db2imstools/db2tools/db2admin/
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
--

Mobil: +49(0)176 562 44 567

Mainframe - 2nd to NONE

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Itschak Mugzach
2016-07-18 19:50:33 UTC
Permalink
Raw Message
OK. a short code sample. Just to mention I am running z/os 2.2 (updated to
Dec15). {lease ignore the last value. it is handled in the complete
program:
Json = '?'
xRest = '"aaa":"11","bbb":"22","ccc":"333"'
Do i = 1 to 6 until xJson = ''
Parse Var xRest '"' xName '":"' xValue '",' xRest
Json.i = Strip(xName)
Say '-'xname'-'
Json.xName = xValue
Say Json.JsonCode
xName = xRest
End

Say Json.aaa /*Returns ? */
​x1 = Json.1
Say Json.x1 /* Returns 11 */




ITschak Mugzach
Z/OS, ISV Products and Application Security & Risk Assessments Professional
Post by Karlheinz Wittemann
If you use the item of a variable to bild a stem, its case-sensitive.
Heinz
Post by Pedro Vera
/* rexx */
xxx = 'James Peterson Ben Franklin'
Do i = 1 to 2
Parse var xxx xname xvalue xxx
xname = translate(xname)
say 'xname('xname')'
xarray.i = xname
xarray.xname = xvalue
End
Say 'xarray.james' xarray.james /* returns the correct value, peterson */
xname = xarray.1
Say 'xarray.xname' xarray.xname /* returns the correct value, peterson */
Pedro Vera
DB2 Admin Tool
http://www-01.ibm.com/software/data/db2imstools/db2tools/db2admin/
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
--
Mobil: +49(0)176 562 44 567
Mainframe - 2nd to NONE
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Pedro Vera
2016-07-18 23:02:36 UTC
Permalink
Raw Message
Consider this example:
001 /* REXX */
002 xname = 'aaa'
003 json.xname = '11'
004
005 xname = 'AAA'
006 json.xname = '22'
007
008 xname = 'aaa'
009 say 'aaa json.xname('json.xname')'
010
011 xname = 'AAA'
012 say 'AAA json.xname('json.xname')'

It has two assignment statements... you may think the second assignment
wins, with the two say statements having the same result. But the result
is actually this:
aaa json.xname(11)
AAA json.xname(22)

As Heinz mentioned, the parts of the stem name are case sensitive.

In Itschak's example, the stem variable is saved using a lower case
qualifier and later tries to retrieve the stem variable using upper case.
This:
Say Json.aaa
fails because rexx treats the 'aaa' as a variable name. 'aaa' is an
uninitialized variable, so it uses its uppercased name as the value, it
tries to do this instead:
Say Json.AAA



Pedro Vera
DB2 Admin Tool
http://www-01.ibm.com/software/data/db2imstools/db2tools/db2admin/


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Itschak Mugzach
2016-07-19 07:38:34 UTC
Permalink
Raw Message
The cod was tested on 1.13 and worked as expected. On 2.2 it fails as
described before. I wrote many programs that uses the direct and sequential
array access so this code is very familiar. Will contact IBM to open a PMR

Best,
ITschak

ITschak Mugzach
Z/OS, ISV Products and Application Security & Risk Assessments Professional
Post by Pedro Vera
001 /* REXX */
002 xname = 'aaa'
003 json.xname = '11'
004
005 xname = 'AAA'
006 json.xname = '22'
007
008 xname = 'aaa'
009 say 'aaa json.xname('json.xname')'
010
011 xname = 'AAA'
012 say 'AAA json.xname('json.xname')'
It has two assignment statements... you may think the second assignment
wins, with the two say statements having the same result. But the result
aaa json.xname(11)
AAA json.xname(22)
As Heinz mentioned, the parts of the stem name are case sensitive.
In Itschak's example, the stem variable is saved using a lower case
qualifier and later tries to retrieve the stem variable using upper case.
Say Json.aaa
fails because rexx treats the 'aaa' as a variable name. 'aaa' is an
uninitialized variable, so it uses its uppercased name as the value, it
Say Json.AAA
Pedro Vera
DB2 Admin Tool
http://www-01.ibm.com/software/data/db2imstools/db2tools/db2admin/
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Paul Gilmartin
2016-07-20 22:48:40 UTC
Permalink
Raw Message
Post by Itschak Mugzach
OK. a short code sample. Just to mention I am running z/os 2.2 (updated to
Dec15). {lease ignore the last value. it is handled in the complete
Json = '?'
xRest = '"aaa":"11","bbb":"22","ccc":"333"'
Do i = 1 to 6 until xJson = ''
Parse Var xRest '"' xName '":"' xValue '",' xRest
Json.i = Strip(xName)
Say '-'xname'-'
Json.xName = xValue
Say Json.JsonCode
xName = xRest
End
Say Json.aaa /*Returns ? */
​x1 = Json.1
Say Json.x1 /* Returns 11 */
I wrapped your sample in a few statements to make z/OS recognize it:

/* Rexx */
if 0 then trace R

Json = '?'
xRest = '"aaa":"11","bbb":"22","ccc":"333"'
Do i = 1 to 6 until xJson = ''
Parse Var xRest '"' xName '":"' xValue '",' xRest
Json.i = Strip(xName)
Say '-'xname'-'
Json.xName = xValue
Say Json.JsonCode
xName = xRest
End

Say Json.aaa /*Returns ? */
x1 = Json.1
Say Json.x1 /* Returns 11 */

exit( 123 )

I ran it on Regina under Cygwin, Regina under Linux, and Rexx on z/OS 2.2.
In each case the output was:

-aaa-
JSON.JSONCODE
-bbb-
JSON.JSONCODE
-ccc-
JSON.JSONCODE
--
JSON.JSONCODE
--
JSON.JSONCODE
--
JSON.JSONCODE
JSON.AAA
11

Is this any different from what you expect? I haven't z/OS 1.13 convenient
to test.

I notice that variable JsonCode is never assigned. Is this a mistake?

-- gil

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Paul Gilmartin
2016-07-19 16:17:37 UTC
Permalink
Raw Message
Post by Pedro Vera
/* rexx */
xxx = 'James Peterson Ben Franklin'
Do i = 1 to 2
Parse var xxx xname xvalue xxx
xname = translate(xname)
Or even just "Parse upper var xxx xname xvalue xxx"

But perhaps the OP wants case preserved. Would you wish
to be known everywhere as "PEDRO VERA"?

-- gil

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Loading...