Text file delimiter - space + TAB + space
Moderators: chulett, rschirm, roy
Text file delimiter - space + TAB + space
Hi All,
I need to read a sequential file which is delimited as "space + TAB + space".
The Hex code for space is 020h and for TAB is 009h.
I don't know how to specify this kind of delimiter in the Sequential file stage under the delimiter text box in the format tab.
Any advice?? suggests are welcome!!
Thanks.
Uriel
I need to read a sequential file which is delimited as "space + TAB + space".
The Hex code for space is 020h and for TAB is 009h.
I don't know how to specify this kind of delimiter in the Sequential file stage under the delimiter text box in the format tab.
Any advice?? suggests are welcome!!
Thanks.
Uriel
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Hi and Welcome aboard
Try reading in each record as a single column and apply a ereplace() on the incoming to replace the "space+TAB+space" to a single demiliter (comma or pipe) and process as per your requirements.
Whale.
Try reading in each record as a single column and apply a ereplace() on the incoming to replace the "space+TAB+space" to a single demiliter (comma or pipe) and process as per your requirements.
Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
If you mean column delimiter, then you could try using only TAB (&H09) as the delimiter, and trim those spaces from respective columns. Or else use a filter Command / before job subroutine and replace them all with a single delimiter of your preference.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Or use a Filter command in your Sequential File stage to effect the same pre-processing using, for example, a sed or awk script. The Sequential File stage reads stdout from the filter command.
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.
thanks but...
There are some standards under our BI department which specified that no UNIX commands can be used to transform data in the ETL process. It includes filter commands under the Seq file stage.
I can't use Trim function because some data include leading spaces which are required. I think that I will create a Transform or Routine for removing the first and the last character of each column.
do you have another suggestion?
Regards
this is my second post =0) :D
I can't use Trim function because some data include leading spaces which are required. I think that I will create a Transform or Routine for removing the first and the last character of each column.
do you have another suggestion?
Regards
this is my second post =0) :D
Re: thanks but...
Yes, revert back, with full force, on such restrictions. You are sitting on a unix box and cannot utilize the power of unix utilities. I would feel crippled.urma wrote:
do you have another suggestion?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Well ! The solution I provided using ereplace works perfectly for your case. I even tested it out.
Why not use that?
It's simple.
Whale.
Why not use that?
It's simple.
Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Thanks all...
Finally the person who provide me with the files changed the column delimiter to TAB delimited.
thank you for your advices and suggestions!!!!
Regards!!
thank you for your advices and suggestions!!!!
Regards!!
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America