Page 1 of 1

Text file delimiter - space + TAB + space

Posted: Tue Jun 19, 2007 5:29 pm
by urma
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

Posted: Tue Jun 19, 2007 6:48 pm
by I_Server_Whale
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.

Posted: Tue Jun 19, 2007 7:04 pm
by JoshGeorge
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.

Posted: Tue Jun 19, 2007 7:05 pm
by ray.wurlod
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.

thanks but...

Posted: Wed Jun 20, 2007 8:47 am
by urma
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

Re: thanks but...

Posted: Wed Jun 20, 2007 9:53 am
by DSguru2B
urma wrote:
do you have another suggestion?
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.

Posted: Wed Jun 20, 2007 12:50 pm
by I_Server_Whale
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.

Thanks all...

Posted: Wed Jun 20, 2007 2:18 pm
by urma
Finally the person who provide me with the files changed the column delimiter to TAB delimited.

thank you for your advices and suggestions!!!!

Regards!! :lol:

Posted: Wed Jun 20, 2007 4:34 pm
by I_Server_Whale
Wonder whether the topic is "Resolved" or a "Workaround". :roll: