Extract & Save Unknown Headers

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

Extract & Save Unknown Headers

Post by karthi_gana »

All,

I have a file with below format.

Header --> *H*
Detail
Trailer --> *T*

File should have,

*H*
<Country Name ....>
<Country Name ....>
*T*

I want to capture where Header <> *H* and Trailer <> *T*. The tricky thing is, I don't know what will come apart from *H* and *T*.

If I write like <> *H* , It will capture other records


Scenario 1:

Even I can't go with number of rows...Incase If I received file something like

*H*
#T*
#H#
*H#

I have to capture the remaining 3 records...

Scenario 2:

File has only 1 header, but it has

#H$

How should I identify this unknown header?


Inputs are welcome!
Karthik
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Read each row of the file as a single VarChar of suitable size (or even unbounded).

Parse and filter in a downstream Transformer stage. Use appropriate substrings (in stage variables) for the first, second and third characters, and perform the logic on those.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply