Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Line continuation in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Mon Dec 12, 2011 11:50 pm    Post subject: Line continuation in REXX
Reply with quote

Hi,

In my REXX code there is a variable where I am editing some values.
The variable is like

Code:
ORC=ST1","ED1","VRX1"X,",
    ST2","LN2","VRX2"X,",
    ST3","LN3           


The last ',' (comma) I used is for continuation to next line. But because of this one blank is coming unnecessarily. It is coming as

Code:
ORC= 1,4,5, 2,5,6, 3,6


But my expectation is
Code:
ORC= 1,4,5,2,5,6,3,6



Can any one tell me where I am doing the mistake?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Dec 12, 2011 11:58 pm    Post subject: Reply to: Line continuation in REXX
Reply with quote

What are you trying to do with the X?

Have you tried something like to trace the intermediate values?
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Tue Dec 13, 2011 12:03 am    Post subject:
Reply with quote

Hi Bill,

Actually I am substituting the values in a sort card.

The code snippet is slightly wrong. It has to be


Code:
ORC= 1,4,5x, 2,5,6x, 3,6


These values are getting substituted in the skel JCL. Hence trace is not hlpng me.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Dec 13, 2011 12:10 am    Post subject:
Reply with quote

Using a comma to continue a string constant implicitly infixes an extra space. Do this:
Code:
ORC=ST1","ED1","VRX1"X," ||,
    ST2","LN2","VRX2"X," ||,
    ST3","LN3       
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Dec 13, 2011 12:17 am    Post subject:
Reply with quote

Quote:

These values are getting substituted in the skel JCL. Hence trace is not hlpng me.


You already have the solution, from the learned (you have to get the emphasis correct on that one, think of courtroom dramas from the UK...) Mr Akatsukami. Next time you have a snippet you think you can't trace, copy it somewhere else where there is nothing else to interfere with it, and then trace it.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Tue Dec 13, 2011 12:20 am    Post subject:
Reply with quote

There are several to do this..

Code:
ORC = ST1||','||ED1||','||VRX1||'X,'||,
      ST2||','||LN2||','||VRX2||'X,'||,
      ST3||','||LN3
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Tue Dec 13, 2011 12:26 am    Post subject:
Reply with quote

Thanks Akatsukami.

It is working fine now.

But I really didn't inderstood how it is working. If you can put some light on it then it it will be helpful.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Dec 13, 2011 1:01 am    Post subject:
Reply with quote

Priyanka Pyne wrote:
Thanks Akatsukami.

It is working fine now.

But I really didn't inderstood how it is working. If you can put some light on it then it it will be helpful.

As you will know, there are three ways of doing string concatenation in Rexx:
  1. With an explicit concatenation operator. The result of
    Code:
    foo = "BAR"
    foo = foo || "ABBAS"
    say foo

    is "BARABBAS".
  2. By abutting the arguments. The result of
    Code:
    foo = "BAR"
    foo = foo"ABBAS"
    say foo

    is also "BARABBAS".
  3. By listing the arguments as rvalues (to the right of the assignment operator). The result of
    Code:
    foo = "BAR"
    foo = foo "ABBAS"
    say foo

    is "BAR ABBAS". Note the infixed space; listing the arguments as rvalues implicitly concatenates a space between each one.

Now, look at your code snippet:
Code:
ORC=ST1","ED1","VRX1"X,",
    ST2","LN2","VRX2"X,",
    ST3","LN3           

This is a concatenation of type 2, by abutting arguments; thus you expected no spaces in ORC. However, the MVS Rexx interpreter handles continued lines by concatenating the two lines and replacing the comma with a space. Thus, it reformatted your statement as
Code:
ORC=ST1","ED1","VRX1"X," ST2","LN2","VRX2"X," ST3","LN3

with spaces as indicated.

The use of an explicit concatenation operator overrides the other two means of concatenation (because when the interpreter find a concat operator, it discards any whitespace to either side), so it gives the desired result.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Tue Dec 13, 2011 1:07 am    Post subject:
Reply with quote

Thanks a lot for explaining this elaborately.
Back to top
View user's profile Send private message
surbhi jain

New User


Joined: 10 Feb 2012
Posts: 7
Location: INDIA

PostPosted: Wed Feb 22, 2012 1:10 pm    Post subject:
Reply with quote

Hi
I tried using the above concatination technique, but still i am getting error as continuation line missing , i am using it in include condition as below:

Code:
PUSH " INCLUDE COND=("SKEY","LENGTH",CH,"R1",C"STNG"),AND,
                        ("SKEY2",'L2",CH,"R2",C"STNG2")"

In above example i am taking the values of SKEY, LENGTH and all from the pannel and trying to apply search condition based on two conditions and after "AND" i want it to continue the line and take both serach criteria into account.
Can you please let me know how is it possible.

thanks in advance
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Feb 22, 2012 2:13 pm    Post subject: Reply to: Line continuation in REXX
Reply with quote

each line of a group must be properly terminated
looks like the first one is not...
when concatenating <strings> in a multiline statement it is wiser to use,
across the continuation the explicit concatenation operator
reread and meditate on the answers given and it will be easy to find the glitch

anyway the <string> was badly formatted
try with
Code:
say  " INCLUDE COND=("SKEY","LENGTH",CH,"R1",C'"STNG"'),AND,("SKEY2","LENGTH2",CH,"R2",C'"STNG2"')"


and split on multiple lines according to the rules like

Code:
say  " INCLUDE COND=("SKEY","LENGTH",CH,"R1",C'"STNG"'),AND,(" || ,
                      SKEY2","LENGTH2",CH,"R2",C'"STNG2"')"
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 What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us