Page 1 of 1

reading of the fixed width file with Header and tail

Posted: Thu Apr 03, 2008 1:13 am
by chvenkat.v
I am having one requirement regarding reading of the fixed width file with Header, Tail and data information.

The file looks like :::

90 20071001 3
91 AED EMIRATS ARABES ARS 0.84563700 1.18254000 1 AE
91 AED EMIRATS ARABES AUD 0.33151200 3.01649000 1 AE
91 AED EMIRATS ARABES BDT 18.76790000 0.05328200 1 AE
91 AED EMIRATS ARABES BOB 2.15611000 0.46379800 1 AE
99 20071031 3

Where the first & last line consits of three columns (Header & tail data )
Block type definition : 90
Application date for company : 20071001
Type of currency ::: 3
And data consists of 9 columns .
The header information is not used in target side.
In my output file consists only columns from data rows.


Can anyone please tell me how to read such files.

thnks
venkat
:)

Posted: Thu Apr 03, 2008 1:28 am
by ArndW
Venkat - I am certain I responded to this query with a post yesterday, but I cannot see (or is this a duplicate thread?). Ah, yes - a duplicate identical question to this thread with a different userid

Posted: Thu Apr 03, 2008 1:28 am
by ray.wurlod
Add a reject-handling link to the Sequential File stage. It will capture the header and trailer rows because they do not match the record schema of a detail rows. These captured rows can then be re-parsed using, for example, a Column Input stage.

Posted: Thu Apr 03, 2008 2:38 am
by chvenkat.v
hi ArndW,

my problem is something Similarly

But here my case tail data is their and my onsite people said that read the data with varchar datatype.

then write shell program to remove those head and tail meta data and call in the trm stage.

seq_file -> tfm stage
( call shell program)
seq. file is fixed width file
i don't have the idea of call shell program in tfm stage. pls give me how to do that and if possible pls give me code of shell program.


thnks
venkat

Posted: Thu Apr 03, 2008 3:12 am
by ray.wurlod
You would not call the shell program from the Transformer stage. You would more likely call it from a before-job subroutine, using ExecSH. But, as I indicated earlier, it is not necessary to incur the overhead of starting another shell.

Posted: Thu Apr 03, 2008 7:54 am
by chulett
If all you want are the data rows, can you not just define that metadata in the stage and anything that doesn't match - header,trailer - will automatically be 'ignored' by the stage, yes?

Posted: Thu Apr 03, 2008 5:21 pm
by ray.wurlod
Alas, the default is "Fail" - you would need to change the "import failed" rule to Drop or Output.