Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
String manupulation in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
Author Message
Rexxguy

New User


Joined: 25 Sep 2008
Posts: 1
Location: Malaysia

PostPosted: Fri Sep 26, 2008 11:52 am    Post subject: String manupulation in REXX
Reply with quote

Hi Guys,

Can you please tell me how to move a words in string of words to particular position using REXX...

Example...

From

Code:
1234567890123456789012345678901234567890123456789012345678901
REXX IS GOOD TO LEARN AS  A SYSTEM LANGUAGE

To
Code:
1234567890123456789012345678901234567890123456789012345678901
REXX IS GOOD----spaces-----------------TO--spaces----LEARN
AS A SYSTEM LANGUAGE


I would like to change the TO stmt to pos 40 and LEARN to 54 pos...
after movement if there is enough space in the line the rest of words can be accomodated...else I need to write to the next line...

Is there any way around in REXX to achive the above solution..
Back to top
View user's profile Send private message
References
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 3168
Location: italy

PostPosted: Fri Sep 26, 2008 12:36 pm    Post subject: Reply to: String manupulation in REXX
Reply with quote

did You care to search the forum for "rexx string" ( all the terms )
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 92
Location: London

PostPosted: Fri Sep 26, 2008 12:43 pm    Post subject:
Reply with quote

u can try something like this:

Code:

/* rexx */                                             
str = 'Rexx is good to learn as a system language'     
str1 = left(substr(str,1,pos('to',str)-1),40,' ')     
str2 = substr(str,pos('to',str))                       
say str1 || str2                                       
exit                                                   


but not really sure why would u want to do this? icon_exclaim.gif

there can be many other ways if u look at string functions

check this out

http://www.kilowattsoftware.com/tutorial/rexx/
Back to top
View user's profile Send private message
Maverick34

New User


Joined: 19 Aug 2007
Posts: 4
Location: UK

PostPosted: Fri Sep 26, 2008 12:44 pm    Post subject:
Reply with quote

You can fill out a string with a "pad" field using the "substr" function, plus it can be used to carve up a sting into separate parts.

Check out the manual.

Regards

Mark
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8729
Location: 221 B Baker St

PostPosted: Fri Sep 26, 2008 7:45 pm    Post subject:
Reply with quote

Hello rg and welcome to the forums,

Quote:
after movement if there is enough space in the line the rest of words can be accomodated...else I need to write to the next line..
Your example does not show this. . . Why is "AS" not on the same line with LEARN?

If there are no solid rules, it will be difficult to implement.

Also, please note that your "data" has been "Code"ed - using the "Code" tag at the top of the Reply panel. This uses a fixed font and will preserve your alignment. Use Preview to see how your post will appear to the forum (rather than how it appears in the reply editor). When your are satisfied with the appearance, Submit.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1