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

how to replace blank " " with "." to column 1


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

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Mon Apr 13, 2015 11:21 pm
Reply with quote

I'm new to this forum an have a special question...

how to delete space ' ' to first column member...

input:

Code:

    abcd efgh
  abcd efgh
      abcd efgh
        abcd efgh


noblank = space(input,0) but how to first the space from colum 1?

output:

Code:

abcd efgh
abcd efgh
abcd efgh
abcd efgh


then, how to replace the blank ' ' with '.'

mailto = TRANSLATE(input,' ','.') right??

output desidered:

Code:

abcd.efgh
abcd.efgh
abcd.efgh
abcd.efgh



thanks for your help.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Apr 14, 2015 12:04 am
Reply with quote

I am not sure what do you mean when you say Column 1. What do you want to do at column 1?

Going by the rest of the post, I'll suggest you first use TRANSLATE and then STRIP function i.e. first translate all spaces to '.' and then remove leading and trailing '.' by STRIP function:

TRANSLATE(String,'.',' ')
STRIP(String,,'.')

Hope you get what you want.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Tue Apr 14, 2015 12:29 am
Reply with quote

thank RahulG31 for answer,

i want first cancel (delete) the space from colum 1 to the first letter for word...

from:
Code:

    abcd efgh
      abcd efgh
            abcd efgh
        abcd efgh


to:

Code:

abcd efgh
abcd efgh
abcd efgh
abcd efgh



then replace the space " " with "."

final result:

Code:

abcd.efgh
abcd.efgh
abcd.efgh
abcd.efgh



thanks...
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Apr 14, 2015 12:35 am
Reply with quote

Not sure why would you want to do that in that particular order.

But you can easily do that by first STRIP the leading and trailing spaces. Then TRANSLATE all spaces to '.' and then STRIP the trailing '.'

I am sure there can be better ways but this is as quick as I can comment.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Tue Apr 14, 2015 12:42 am
Reply with quote

thanks again... i'm new in rexx language. ... i'm test tomorrow.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Tue Apr 14, 2015 1:54 pm
Reply with quote

edit:

hi i'm resolved in this way: SPACE(' abcd efgh ij ',1,'.')

Code:
address tso "execio * diskr CMAREAIN (stem CMAREAIN. finis"
 if rc>0 then exit 12
 CMAREAIN.1 = TRANSLATE(CMAREAIN.1)
 domain = "§domain.com"
 out = 0
do in=1 to CMAREAIN.0
      nincm = SPACE(CMAREAIN.in,1,'.')domain
      out=out+1
      CMAREAEM.out = nincm
      CMAREAEM.0   = out
      say ' - new string without space:' nincm
end


from:
Code:
    abcd efgh
      abcd efgh
            abcd efgh ij
        abcd efgh ij


to:

Code:

abcd.efgh§domain.com
abcd.efgh§domain.com
abcd.efgh.ij§domain.com
abcd.efgh.ij§domain.com


thanks for you help.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Tue Apr 14, 2015 4:16 pm
Reply with quote

hi again...

please, how to write "RCPT TO:<" and ">" for each line of my file in input?? maybe with push and pull option?? i'm confused..

from:

Code:
abcd.efgh§domain.com
abcd.efgh§domain.com
abcd.efgh.ij§domain.com
abcd.efgh.ij§domain.com


to:

Code:
RCPT TO:<abcd.efgh§domain.com>
RCPT TO:<abcd.efgh§domain.com>
RCPT TO:<abcd.efgh.ij§domain.com>
RCPT TO:<abcd.efgh.ij§domain.com>


any sample ??

thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Apr 14, 2015 5:27 pm
Reply with quote

something along the lines of

Code:

id.1 = "abc def"
id.2 = "    efg hij"
id.3 = " klm nop qrs  "
id.0 = 3

do    i = 1 to id.0
   od.i = "RCPT TO:<"space(id.i,1,'.')"@domain.com>"
end
od.0 = id.0

do    i = 1 to od.0
   say i od.i
end


to get

Code:

1 RCPT TO:<abc.def@domain.com>
2 RCPT TO:<efg.hij@domain.com>
3 RCPT TO:<klm.nop.qrs@domain.com>
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Tue Apr 21, 2015 2:57 am
Reply with quote

thanks Enrico, i'm resolved this:

name
Code:
abc def       
    efg hij   
 klm nop qrs 


for fileout1
Code:
namerc = "RCPT TO:<"SPACE(name,1,'.')"@domain.com>"
fileout1.oucm =  namerc
fileout1.0=oucm


result fileout1

Code:
RCPT TO:<abc.def@domain.com>   
RCPT TO:<efg.hij@domain.com>   
RCPT TO:<klm.nop.qrs@domain.com>


and

for fileout2
Code:
nameto = "TO:"SPACE(name,1,'.')"@domain.com"
fileout2.oucm =  nameto
fileout2.0=oucm


resut fileout2

Code:
TO:abc.def@domain.com     
TO:efg.hij@domain.com     
TO:klm.nop.qrs@domain.com 


thanks for you help, again.
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top