How to extract Header and Detail Records separately

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
srinivas143
Participant
Posts: 30
Joined: Tue Feb 19, 2008 11:02 pm

How to extract Header and Detail Records separately

Post by srinivas143 »

Hi All

I need to extract the header of the file and its detail records separately and do some validations and after that again I need to merge them together.

Soure data
-------------
ID|COUNTRY_ID|F2400|F2500|F2600
101|1|1001|1002|1003
102|2||1004|1006
103|3|1005||1008

I want to extract the header and do some validations and after that again I need to merge the header with the detail records..

Pls Help me......

Kind Regards
wahi80
Participant
Posts: 214
Joined: Thu Feb 07, 2008 4:37 pm

Re: How to extract Header and Detail Records separately

Post by wahi80 »

Just put a condition to check if if first two characters are ID
srinivas143
Participant
Posts: 30
Joined: Tue Feb 19, 2008 11:02 pm

Post by srinivas143 »

Thanks for giving reply..

Can you please explain me clearly



Kind Regards
gxhpainter
Premium Member
Premium Member
Posts: 28
Joined: Tue Jul 01, 2008 9:23 am

Re: How to extract Header and Detail Records separately

Post by gxhpainter »

I have faced similar issue before. We resolved using the Stage varibles in Transformation stage.
It will loop till we have next occurance of Header ID.

Or you have Transformer Stage filter thru constraints check for header ID occurance.

Try any of the solution.

Rgds,
Chakradhar.
gxhpainter
Premium Member
Premium Member
Posts: 28
Joined: Tue Jul 01, 2008 9:23 am

Re: How to extract Header and Detail Records separately

Post by gxhpainter »

Next simple solution is write a Unix Script , you can make 2 files like header and detail files and process them separetely. It is quite simple compared to dataStage job.

Rgds,
Chakradhar.
ajmore
Participant
Posts: 22
Joined: Fri Aug 25, 2006 5:25 am

Re: How to extract Header and Detail Records separately

Post by ajmore »

looking at the data it feels like your header is an record that starts with an value "ID" check for that and then move it to an different link using an transformer, do the same with your Trailer record.Could be done using a Transformer and defining appropriate constraints in it.
Post Reply