Text file delimiter - space + TAB + space

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
urma
Participant
Posts: 5
Joined: Thu Mar 09, 2006 11:54 am

Text file delimiter - space + TAB + space

Post 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
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post 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.
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
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post 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.
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>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
urma
Participant
Posts: 5
Joined: Thu Mar 09, 2006 11:54 am

thanks but...

Post 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
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Re: thanks but...

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post 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.
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
urma
Participant
Posts: 5
Joined: Thu Mar 09, 2006 11:54 am

Thanks all...

Post 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:
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Wonder whether the topic is "Resolved" or a "Workaround". :roll:
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
Post Reply