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
 

 

How to add spaces to the existing string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: How to add spaces to the existing string
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am


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