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
 

 

String manupulation in REXX

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

New User


Joined: 25 Sep 2008
Posts: 2
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

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
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: 210
Location: St Katherine's Dock 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

Site Director


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

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
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 REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts REXX WTO for console message bipinpeter CLIST & REXX 6 Tue Jun 27, 2017 3:56 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am


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