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

How to add spaces to the existing string


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anilsanda

New User


Joined: 07 Jun 2007
Posts: 15
Location: chennai

PostPosted: Thu Feb 14, 2008 3:04 pm
Reply with quote

Hi,
I want to add spaces to a string when length of it is less than the required length.Is there any command to do this?
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Feb 14, 2008 3:15 pm
Reply with quote

are you talking about Rexx?
you can concatenate strings using ||

Code:

string1='I can't find the'
string2='Rexx manuals'

string3= string1 || string2      => string3 ='I can't find theRexx manuals'
or
string3= string1 ||' '|| string2 => string3 ='I can't find the Rexx manuals'
or
string3= string1 string2         => string3 ='I can't find the Rexx manuals'



;)
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Feb 14, 2008 3:16 pm
Reply with quote

btw..., if Rexx, search for LEFT or COPIES...
Back to top
View user's profile Send private message
anilsanda

New User


Joined: 07 Jun 2007
Posts: 15
Location: chennai

PostPosted: Thu Feb 14, 2008 3:21 pm
Reply with quote

consider this example:
if the string is "good luck" the length of the string is 9 but i want to increase the lenghth of this string to length of 30 by adding spaces after the last word in the string.
How can i do this
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Feb 14, 2008 3:40 pm
Reply with quote

what you ask it could be done with just invoking the LEFT builtin in a proper way.

search, read and try it, then post any doubt you have.
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Fri Feb 15, 2008 4:43 pm
Reply with quote

hey,

Code:
 str = 'good luck'       
 l= length(str)         
 str1=left(str,30,' ')   
 l1 = length(str1)       
 say l l1       


Here l = 9 and l1 = 30.
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 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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Adding first / last acct numerber to ... DFSORT/ICETOOL 7
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
Search our Forums:

Back to Top