Page 1 of 1

Extract & Save Unknown Headers

Posted: Wed Oct 28, 2015 9:14 am
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!

Posted: Wed Oct 28, 2015 1:12 pm
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.