Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
REXX seems to continue reading source without trailing comma

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: REXX seems to continue reading source without trailing comma
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: 683
Location: Pennsylvania

PostPosted: Fri Feb 18, 2011 7:03 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Fri Feb 18, 2011 7:30 pm    Post subject: Reply to: REXX seems to continue reading source without trai
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    Post subject:
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: 658
Location: Whitby, ON, Canada

PostPosted: Fri Feb 18, 2011 9:30 pm    Post subject:
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    Post subject: Reply to: REXX seems to continue reading source without trai
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

Site Director


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

PostPosted: Sun Feb 20, 2011 2:33 am    Post subject: Reply to: REXX seems to continue reading source without trai
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Sun Feb 20, 2011 5:03 pm    Post subject: Reply to: REXX seems to continue reading source without trai
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Creating ISPF Screens with Scrname vi... Albireo20 TSO/ISPF 9 Tue Sep 05, 2017 4:24 pm
No new posts How to Run Rexx Macro? Kalaivignesh CLIST & REXX 5 Fri Sep 01, 2017 9:08 pm
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us