f



error or not an error ...

I was just testing out the R4 REXX thingy, and it found an
error in the following program.  My question is this, is it
an error or not?  My PC/REXX and Regina don't barf on it,
but I thought they should've.
_____________________________________________

/**/
?.=''
?.z='batman'
trace i


if ?.z\==''then do; say '?.z=' ?.z; end
______________________________________________

Note that there is space before the  THEN.   I'm not sure
of the exact rules for parsing an IF statement, I know that
THEN is a "reserved" keyword when an IF statement is
encountered, but would this construct (shown above) be some
sort of anomaly ?

I would appreciate it if the IBM mainliners could test out
to see what the IBM REXX interpretors do on this one.
____________________________________________________Gerard S. 


0
gerard46
3/22/2005 4:51:54 PM
comp.lang.rexx 2135 articles. 0 followers. Post Follow

2 Replies
2185 Views

Similar Articles

[PageSpeed] 54

Object Rexx 2.1.3 on Win32

      7 *-* if ?.z\==''
        >C>   "?.Z"
        >V>   "batman"
        >L>   ""
        >O>   "1"
        >>>   "1"
      7 *-*   then
      7 *-*     do;
      7 *-*     say '?.z=' ?.z;
        >L>       "?.z="
        >C>       "?.Z"
        >V>       "batman"
        >O>       "?.z= batman"
        >>>       "?.z= batman"
?.z= batman
      7 *-*   end

Object Rexx 2.3.4.0-4 on Linux

      7 *-* if ?.z\==''
        >C>   "?.Z"
        >V>   "batman"
        >L>   ""
        >O>   "1"
        >>>   "1"
      7 *-*   then
      7 *-*     do;
      7 *-*     say '?.z=' ?.z;
        >L>       "?.z="
        >C>       "?.Z"
        >V>       "batman"
        >O>       "?.z= batman"
        >>>       "?.z= batman"
?.z= batman
      7 *-*   end

-- 
Michael Lueck
Lueck Data Systems

Remove the upper case letters NOSPAM to contact me directly.
0
Michael
3/22/2005 5:16:27 PM
According to gerard46 in a posting to comp.lang.rexx:
>/**/
>?.=''
>?.z='batman'
>trace i
>
>
>if ?.z\==''then do; say '?.z=' ?.z; end

Answer: not error.

Your choices for the word "then" in this instruction are basically
variable or keyword - and since a variable called "then" is not allowed
within the expression of an IF instruction, it must be a keyword.  You
can't confuse the interpreter into treating it as a variable just by
omitting the space.  On the other hand,

 if ?.z\==xthen do

would not be correct because here "xthen" is a variable name and so
the "then" keyword is missing.  And in

 if ?.z\== then do

the "then" is a keyword, but there's a syntax error in the expression
"?.z\==".
-- 
---- Ian Collier : imc@comlab.ox.ac.uk : WWW page (including REXX section):
------ http://users.comlab.ox.ac.uk/ian.collier/imc.shtml

New to this group?  Answers to frequently-asked questions can be had from
http://rexx.hursley.ibm.com/rexx/ .
0
imc
3/23/2005 12:28:47 PM
Reply: