IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

REXX seems to continue reading source without trailing comma


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kurt Deininger

New User


Joined: 13 Jul 2010
Posts: 19
Location: Frankfurt/Germany

PostPosted: Fri Feb 18, 2011 3:48 pm
Reply with quote

Code:

The program:

EXEC       X1N1168.USER.EXEC(WEIRD) - 01.02                Columns 00001 00072
Command ===>                                                  Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000001 /* REXX WEIRD */                                                       
000002    trace r                                                             
000003    nop                                                                 
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000004    lib500="'"f5088(5)".JCLLIBA"'"                                       
000005    fred                                                                 
000006    lib700="'"f5088(7)".JCLLIB1A"'"                                     
000007    fblc500="FBLC='LC500'"                                               
000008    exit                                                                 
000009 F5088: return "F5088WDS.RJ.LC"arg(1)"00"                               
****** **************************** Bottom of Data ****************************

When executing:

      3 *-* nop                                                                 
      4 *-* lib500="'"f5088(5)".JCLLIBA"'"                                     
             fred                                                               
              lib700="'"f5088(7)".JCLLIB1A"'"                                   
      9 *-*  F5088:                                                             
        *-*  return "F5088WDS.RJ.LC"arg(1)"00"                                 
        >>>    "F5088WDS.RJ.LC500"                                             
        >>>   "'F5088WDS.RJ.LC500.JCLLIBA"                                     
             fred                                                               
              lib700="f5088(7).JCLLIB1A'"                                       
      7 *-* fblc500="FBLC='LC500'"                                             
        >>>   "FBLC='LC500'"                                                   
      8 *-* exit                                                               
 ***                                                                           
 


Hi everybody,

The program was written to generate some JCL. During execution,
some weird things happened, so I cut out the offending part and
created this mini-program. For purpose of illustration I inserted
"fred". Now, this program has a syntax error, if you start counting
the quotes on line 4 (at least I think so). It should give the
message "unmatched quote". Instead, it seems to continue reading the
source past the end of line, despite no comma being present, and
recognize end of of line only at the end of line 6, hence it
resumes execution at line 7. I am puzzled. Is there anything I
overlooked, or does REXX somehow malfunction? You can try it easily
on your mainframe.

Cheers. Kurt.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Feb 18, 2011 7:03 pm
Reply with quote

There is no malfunction.

There is no unmatched quote.

The translator continued to match up the quotes until it did at the end of line 6.

I use HILITE AUTO and get nice colors to help match things up.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Feb 18, 2011 7:30 pm
Reply with quote

on my pc Object rexx and regina rexx report the error

seems worth investigating with IBM
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Fri Feb 18, 2011 8:23 pm
Reply with quote

Since REXX recognizes either a single quote or a double quote as literal delimiters, the code shown actually parses like this (if we remove the line numbers) (I've taken the liberty to compress a lot of spaces with <...>):
Code:
 /* REXX WEIRD */                                                       
    trace r                                                             
    nop                                                                 
=COLS> ---1----+----2----+----3----+----4----+----5----+----6----+----7--
    lib500="'"
    f5088(5)
    ".JCLLIBA"
    '"<...>fred<...>lib700="'    note double quoted string within single quoted string
    "f5088(7)"
    .JCLLIB1A
    "'"                                     
    fblc500="FBLC='LC500'"       note single quoted string within double quoted string
    exit                                                                 
 F5088: return "F5088WDS.RJ.LC"arg(1)"00"


And there are no unbalanced deliiters.
So, the output trace would parse like this (which matches what you've shown):

Code:
      3 *-* nop                                                                 
      4 *-* lib500="'"
            f5088(5)
            ".JCLLIBA"
            '"<...>fred<...>lib700="'
            "f5088(7)"
            .JCLLIB1A
            "'"                                   
      9 *-*  F5088:                                                             
        *-*  return "F5088WDS.RJ.LC"arg(1)"00"                                 
        >>>    "F5088WDS.RJ.LC500"                                             
        >>>   "'F5088WDS.RJ.LC500.JCLLIBA"<...>fred<...>lib700="f5088(7).JCLLIB1A'"
      7 *-* fblc500="FBLC='LC500'"                                             
        >>>   "FBLC='LC500'"                                                   
      8 *-* exit
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Feb 18, 2011 9:30 pm
Reply with quote

If you use the HILITE REXX command the ISPF editor shows you quite clearly where Rexx thinks the literals are.
Back to top
View user's profile Send private message
Kurt Deininger

New User


Joined: 13 Jul 2010
Posts: 19
Location: Frankfurt/Germany

PostPosted: Sun Feb 20, 2011 1:50 am
Reply with quote

Thanks everybody,

After using REXX for 21 years, I find out that (on the mainframe) REXX continues reading over the end of line until it finds a closing delimiter.
(Even says so in the book). All my life I used complete strings with a comma (and concatenation if needed) for long literals.
However, PC-REXX versions don't seem to do that.
I use Quercus REXX privately, and it failed with "unmatched quote", just as Enrico reported.
You learn something new every day (especially when you don't know much in the first place).

Cheers. Kurt
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Feb 20, 2011 2:33 am
Reply with quote

Hi Kurt,

Quote:
You learn something new every day

One of the better reasons to get out of bed each day. . . icon_smile.gif

d
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sun Feb 20, 2011 5:03 pm
Reply with quote

anyway under REXX the continuation has /will always be a murky/unclear issue

if You consider that

Code:
parse arg a b
if a = b then
    say "equal"
else
    say "not equal"
exit


Code:
parse arg a b
if a = b then ,
    say "equal"
else ,
    say "not equal"
exit

both work the same way...
( at least on object rexx, I do not have TSO up and running right now )

for clarity I resorted to always use a comma for overall consistency!
cheers
enrico
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top