Re: SV: Rexx bug?
On Tue, 11 Mar 2008 15:09:45 +0100, Thomas Berg <[EMAIL PROTECTED]> wrote: >... >> ... REXX sees 2 equal numbers in the first case and 2 different >> strings in the second case. > >No. REXX sees 1 string in each case ("00E0 00E8" and "00F0 00F8"). >Try x = 00E0 + 00E8 and y = 00F0 + 00F8 >You will get an error in the latter case. >... Ok. I worded that very poorly. Assuming that the exec is going to parse its parm string into hex arguments, it had better take care to handle those args as strings wherever they might be misconstrued as numbers. I know I have not done that since I never thought about scientific notation. I didn't know REXX supported it. Pat O'Keefe -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html
Re: SV: Rexx bug?
In the category "you can't always believe what you read in the manual", 0E123 is 0 times 10 to the 123 power, and 1E342 is 1 times 10 to the 342 power. Mark Wheeler, 3M Company Chris Langford <[EMAIL PROTECTED] OM>To Sent by: IBM IBM-MAIN@BAMA.UA.EDU Mainframe cc Discussion List <[EMAIL PROTECTED] Subject .EDU> Re: SV: Rexx bug? 03/11/2008 09:32 AM Please respond to IBM Mainframe Discussion List <[EMAIL PROTECTED] .EDU> From REXX/VM Reference - Certain character strings are numbers even though they do not appear to be numeric to the user. Specifically, because of the format of numbers in exponential notation, strings, such as 0E123 (0 raised to the 123 power) and 1E342 (1 raised to the 342 power), are numeric. In addition, a comparison such as 0E123=0E567 gives a true result of 1 (0 is equal to 0). To prevent problems when comparing nonnumeric strings, use the strict comparison operators. Thomas Berg wrote: >> -Ursprungligt meddelande- >> Från: IBM Mainframe Discussion List >> [mailto:[EMAIL PROTECTED] För Patrick O'Keefe >> Skickat: den 10 mars 2008 20:50 >> Till: IBM-MAIN@BAMA.UA.EDU >> Ämne: Re: Rexx bug? >> On Mon, 10 Mar 2008 19:16:26 +, Ted MacNEIL >> <[EMAIL PROTECTED]> wrote: >> >>> The simple answer is that the designed the interpreter that way. >>> Whenever possible numeric strings are interpreted as numbers first, >>> unless you perform unnatural acts of coding, regardless of whether >>> you quote it or not. >>> >> While I've known this for years, I've never given it much thought. >> I've been coding REXX since around 1988 but never (knowingly) ran >> into this ... probably because I've never needed to use scientific >> notiation in REXX and never even knew it was supported. I now >> wonder how many comparisons are waiting to fail on me. I can >> just picture very different and unexpected results from the two >> invocations >> x= SOMEEXEC(00E0 00E8) >> y= SOMEEXEC(00F0 00F8) >> where REXX sees 2 equal numbers in the first case and 2 different >> strings in the second case. >> > > No. REXX sees 1 string in each case ("00E0 00E8" and "00F0 00F8"). > Try x = 00E0 + 00E8 and y = 00F0 + 00F8 > You will get an error in the latter case. > > > Regards, > Thomas Berg > _ > Thomas Berg Specialist IT Utveckling Swedbank AB (Publ) > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html > .. > For: [EMAIL PROTECTED] > > > > -- Chris Langford, Cestrian Software: Consulting services for: VM, VSE, MVS, z/VM, z/OS, OS/2, P/3x0 etc. z/FM - A toolbox for VM & MVS at http://zfm.cestrian.com -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html
Re: SV: Rexx bug?
From REXX/VM Reference - Certain character strings are numbers even though they do not appear to be numeric to the user. Specifically, because of the format of numbers in exponential notation, strings, such as 0E123 (0 raised to the 123 power) and 1E342 (1 raised to the 342 power), are numeric. In addition, a comparison such as 0E123=0E567 gives a true result of 1 (0 is equal to 0). To prevent problems when comparing nonnumeric strings, use the strict comparison operators. Thomas Berg wrote: -Ursprungligt meddelande- Från: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] För Patrick O'Keefe Skickat: den 10 mars 2008 20:50 Till: IBM-MAIN@BAMA.UA.EDU Ämne: Re: Rexx bug? On Mon, 10 Mar 2008 19:16:26 +, Ted MacNEIL <[EMAIL PROTECTED]> wrote: The simple answer is that the designed the interpreter that way. Whenever possible numeric strings are interpreted as numbers first, unless you perform unnatural acts of coding, regardless of whether you quote it or not. While I've known this for years, I've never given it much thought. I've been coding REXX since around 1988 but never (knowingly) ran into this ... probably because I've never needed to use scientific notiation in REXX and never even knew it was supported. I now wonder how many comparisons are waiting to fail on me. I can just picture very different and unexpected results from the two invocations x= SOMEEXEC(00E0 00E8) y= SOMEEXEC(00F0 00F8) where REXX sees 2 equal numbers in the first case and 2 different strings in the second case. No. REXX sees 1 string in each case ("00E0 00E8" and "00F0 00F8"). Try x = 00E0 + 00E8 and y = 00F0 + 00F8 You will get an error in the latter case. Regards, Thomas Berg _ Thomas Berg Specialist IT Utveckling Swedbank AB (Publ) -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html .. For: [EMAIL PROTECTED] -- Chris Langford, Cestrian Software: Consulting services for: VM, VSE, MVS, z/VM, z/OS, OS/2, P/3x0 etc. z/FM - A toolbox for VM & MVS at http://zfm.cestrian.com -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html
SV: Rexx bug?
> -Ursprungligt meddelande- > Från: IBM Mainframe Discussion List > [mailto:[EMAIL PROTECTED] För Patrick O'Keefe > Skickat: den 10 mars 2008 20:50 > Till: IBM-MAIN@BAMA.UA.EDU > Ämne: Re: Rexx bug? > On Mon, 10 Mar 2008 19:16:26 +, Ted MacNEIL > <[EMAIL PROTECTED]> wrote: > >The simple answer is that the designed the interpreter that way. > >Whenever possible numeric strings are interpreted as numbers first, > >unless you perform unnatural acts of coding, regardless of whether > >you quote it or not. > > While I've known this for years, I've never given it much thought. > I've been coding REXX since around 1988 but never (knowingly) ran > into this ... probably because I've never needed to use scientific > notiation in REXX and never even knew it was supported. I now > wonder how many comparisons are waiting to fail on me. I can > just picture very different and unexpected results from the two > invocations > x= SOMEEXEC(00E0 00E8) > y= SOMEEXEC(00F0 00F8) > where REXX sees 2 equal numbers in the first case and 2 different > strings in the second case. No. REXX sees 1 string in each case ("00E0 00E8" and "00F0 00F8"). Try x = 00E0 + 00E8 and y = 00F0 + 00F8 You will get an error in the latter case. Regards, Thomas Berg _ Thomas Berg Specialist IT Utveckling Swedbank AB (Publ) -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html
SV: Rexx bug?
Everything is character strings in REXX. Some character strings can be interpreted as numeric values... Consider: var1 = "123" var2 = 5 var3 = var1 * var2 /* gives var3 = 615 */ REXX make a numeric compare if possible. Thomas Berg _ Thomas Berg Specialist IT Utveckling Swedbank AB (Publ) > -Ursprungligt meddelande- > Från: IBM Mainframe Discussion List > [mailto:[EMAIL PROTECTED] För Ulrich Krueger > Skickat: den 10 mars 2008 18:52 > Till: IBM-MAIN@BAMA.UA.EDU > Ämne: Re: Rexx bug? > > > offset1 = "E0" ; > > offset2 = "E8" ; > > if (offset1 = offset2) then say "MATCH!" ; > > else say "NO MATCH!" > > > John, > I'm a little confused now ... > Todd said that his comparison returned 'match'. > If REXX executed a comparison of two equal-length character > strings, then a > 'match' - result would be incorrect. > Only if REXX interpreted the two character strings as > numerical values in > exponent notation (0**0 and 0**8) and performed a numerical > comparison, > would a 'match' - result be expected. But why? That's not > logical. Todd > coded two quoted character strings, didn't he? > > Could someone please run a TRACE and post the results? I can't at the > moment. This really puzzles me. > > > Regards, > Ulrich Krueger > > > -Original Message- > From: IBM Mainframe Discussion List > [mailto:[EMAIL PROTECTED] On Behalf > Of John P. Baker > Sent: Monday, March 10, 2008 10:29 > To: IBM-MAIN@BAMA.UA.EDU > Subject: Re: Rexx bug? > > Ulrich, > > As long as his intent is a simple equality/inequality test, > "=="/"<>" will > work fine, in so far as the offsets are both presented with > the same length > and in the same case. A requirement for x2d(...) will only > arise if the > offsets are presented with the possibility of differing > lengths, differing > cases, or if a comparative magnitude test is required (<, <=, > >=, or >). > > John P. Baker > > -Original Message- > From: IBM Mainframe Discussion List > [mailto:[EMAIL PROTECTED] On Behalf > Of Ulrich Krueger > Sent: 03/10/2008 1:00 PM > To: IBM-MAIN@BAMA.UA.EDU > Subject: Re: Rexx bug? > > Todd, > What is your intent with this comparison? > Do you want to compare two quoted character strings or do you want to > compare the numeric (hexadecimal) values? > If the latter, shouldn't you have coded either > offset1 = "E0"X; > offset2 = "E8"X; > Or > offset1 = x2d("E0"); > offset2 = x2d("E8"); > instead? > > Regards, > Ulrich Krueger > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html > -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html