View previous topic :: View next topic
|
Author |
Message |
italo_pm
New User
Joined: 26 Mar 2015 Posts: 37 Location: Italy
|
|
|
|
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 |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
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 |
|
|
italo_pm
New User
Joined: 26 Mar 2015 Posts: 37 Location: Italy
|
|
|
|
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 |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
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 |
|
|
italo_pm
New User
Joined: 26 Mar 2015 Posts: 37 Location: Italy
|
|
|
|
thanks again... i'm new in rexx language. ... i'm test tomorrow. |
|
Back to top |
|
|
italo_pm
New User
Joined: 26 Mar 2015 Posts: 37 Location: Italy
|
|
|
|
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 |
|
|
italo_pm
New User
Joined: 26 Mar 2015 Posts: 37 Location: Italy
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
italo_pm
New User
Joined: 26 Mar 2015 Posts: 37 Location: Italy
|
|
|
|
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 |
|
|
|