Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

When does "0E604" = "0E953" ?

21 views
Skip to first unread message

Joe Denison

unread,
Mar 12, 2013, 2:19:50 PM3/12/13
to
Can anyone explain why the results of this REXX exec indicate that the contents of the variables "aaa" and "bbb" match, even though based on the output of the SAY instruction just prior to the comparison, they clearly "do not match"?

I can fix it by specifying the strictly equal operator in the comparison (e.g., "=="), but I don't understand why the comparison seems to have incorrect results with just the "=".


EDIT MY.REXX(DSINFOA) - 01.03 Member DSINFOA saved
Command ===> tso dsinfoa Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 /*REXX EXEC*/
000002 Address TSO
000003 bbb="5E604"
000004 aaa="0E953"
000005 IF LEFT(aaa,1)="0" then
000006 DO /*Replace 1st char of "bbb" with a "0" */
000007 bbb="0"||RIGHT(bbb,LENGTH(bbb)-1)
000008 END
000009 say length(bbb) bbb length(aaa) aaa
000010 IF aaa=bbb then say "These two items match: aaa="aaa "bbb="bbb
000011 ELSE say "They don't match, duh!!!"
000012 EXIT
****** **************************** Bottom of Data ****************************


5 0E604 5 0E953
These two items match: aaa=0E953 bbb=0E604
***

Joe Denison

unread,
Mar 12, 2013, 2:47:45 PM3/12/13
to
Now that I'm staring at this, it occurs to me that REXX may be interpreting this as scientific notation? i.e., interpreted as 0 x 10^604 and 0 x 10^953 (both being "0")?

Robert AH Prins

unread,
Mar 12, 2013, 4:15:43 PM3/12/13
to
Yep!

Reminds me of this, a circular compare:

/* REXX */
a = '2e0'
b = '2ee'
c = '1e1'

say "a =" a;
say "b =" b
say "c =" c

if a > b then
say 'a > b'
else
say 'a ^> b'

if b > c then
say 'b > c'
else
say 'b ^> c'

if c > a then
say 'c > a'
else
say 'c ^> a'



--
Robert AH Prins
robert(a)prino(d)org
0 new messages