Handling spaces
Moderators: chulett, rschirm, roy
Handling spaces
There are lot of source files which are fixed width and I am using 'CHAR' to read them and it works well. It also turns out that I get spaces in certain columns because of this. There are more than 80 files and each file has 200+ columns. Is there any way to handle these other than using a Trim in transformer for each column. That may take a long time. Any suggestions?
If you bother about using transformer, use the filter option in sequential file stage .
Just check whether the below sed satisfy your need.
Thanks.
Just check whether the below sed satisfy your need.
Code: Select all
Sed 's/ //g'
pandeeswaran
Yes Craig! you are correct.
I believe there is no other options other than using transformer.
Convert() will handle this(even if the spaces are in between)
I believe there is no other options other than using transformer.
Convert() will handle this(even if the spaces are in between)
Last edited by pandeesh on Sat Jan 07, 2012 12:58 pm, edited 1 time in total.
pandeeswaran
Re: Handling spaces
"Because of this" part is ambiguous.vskr72 wrote:It also turns out that I get spaces in certain columns because of this.?
The spaces are there in the data in file itself and not because of reading as CHAR.Please correct me if i am incorrect.
pandeeswaran
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You do this (what Eric suggested) using "derivation substitution". Select all the columns that you want to change in the output link of the Transformer stage (the ones that are CHAR coming in and VARCHAR going out), right click, choose Derivation Substitution, enter "Trim($1)" as the expression and commit. Magic happens.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.