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

String manupulation in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 26, 2008 12:36 pm
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
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

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
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

Moderator Emeritus


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

PostPosted: Fri Sep 26, 2008 7:45 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top