reading of the fixed width file with Header and tail

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
chvenkat.v
Participant
Posts: 94
Joined: Fri Dec 14, 2007 3:22 am

reading of the fixed width file with Header and tail

Post 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
:)
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chvenkat.v
Participant
Posts: 94
Joined: Fri Dec 14, 2007 3:22 am

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Alas, the default is "Fail" - you would need to change the "import failed" rule to Drop or Output.
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