|
View previous topic :: View next topic
|
| Author |
Message |
karthik_sripal
New User
Joined: 28 Mar 2008 Posts: 69 Location: 125.16.180.5
|
|
|
|
Hi all,
I have a input record to be squeezed but if there is any spaces as the only value in the field - I would like to retain only one space.
could any of you please help how we could achive this
Input record
| Code: |
"AA ","BBBBB ","CCC'CCCC ","DDD D"," "
|
My current sort cord
| Code: |
OPTION COPY
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))
|
My current output
| Code: |
"AA","BBBBB","CCC'CCCC","DDDD",""
|
Whereas my expected output is
| Code: |
"AA","BBBBB","CCC'CCCC","DDDD"," "
|
Please note the space in the last field.
Thank you very much! |
|
| Back to top |
|
 |
karthik_sripal
New User
Joined: 28 Mar 2008 Posts: 69 Location: 125.16.180.5
|
|
|
|
Kind of arrived at the solutions
But is there any other intresting solution - I would like to know !
| Code: |
OPTION COPY
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))
OUTREC FINDREP=(IN=C',""',OUT=C'," "') |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I hink you're about there. You don't need both INREC and OUTREC. I assume you want the embedded blank to disappear from "DDD D"? The inclusion of the "," in your test isn't strictly needed (you shouldn't have another way to get "" together) and it would mean your code would not work if the first "column" of your CSV were "blank".
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,80,SQZ=(SHIFT=LEFT))),
IFTHEN=(WHEN=INIT,FINDREP=(IN=C'""',OUT=C'" "')) |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|