Join Header and Tralier

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
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Join Header and Tralier

Post by kumar66 »

Hi All,

I need to join the headers and traliers of the file.

I dont have any key coloumn on header or tralier. I need to to seperate header , detail records and tralier seperately . And for validating header and tralier records , I need to join them.

Please Advise.

Thanks & Regards,
Kumar.R
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Define 'join' in this context. Actually - spell out in words for us (and you) exactly what you need to do with the header and trailer records. Without using the word 'join'. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
prasanna2883
Participant
Posts: 26
Joined: Tue Oct 23, 2007 4:07 am
Location: Blore,India

Post by prasanna2883 »

Whether the Header and Trailer records are in Sequential file? Do you want to merge them into single file or do you want to join them? Send brief description of your requirement.
asdfasdf
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

My guess - though let's wait for the OP to get back - is that the requirement is to compare the number in the header and the number in the trailer.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi All,
Thanks for your replies . I need to validate all the fileds in the header and tralier.

Bascially I need to merge the header and tralier record .

For example. my header has 18 fields and tralier has 3 fields. My output should have 21 fields as one row.

Please Advise.

Thanks & Regards,
Kumar66.
ameyvaidya
Charter Member
Charter Member
Posts: 166
Joined: Wed Mar 16, 2005 6:52 am
Location: Mumbai, India

Post by ameyvaidya »

In an External Command Stage, use the following Source program:

Code: Select all

echo "`head -1 <FilePath+Name>`<Delimiter>`tail -1 <FilePath+Name>`" 
replace <FilePath+Name> and <Delimiter> with the appropriate text.

HTH.
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or, indeed, in an External Source 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.
ameyvaidya
Charter Member
Charter Member
Posts: 166
Joined: Wed Mar 16, 2005 6:52 am
Location: Mumbai, India

Post by ameyvaidya »

ray.wurlod wrote:Or, indeed, in an External Source stage. ...
Whoops!!! :oops: Typo!!!

Thanks Ray.. thats what I meant to say!!!
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi All,

Thanks once again. I need the header fields 18 and tralier fileds 3 as one row.

Now my requirement has changed and I have a key filed in the header and the tralier.

Is this possible if I use a full outer join making a key filed in header and tralier?

Please Advise.

Thanks & Regards,
Kumar66
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, but why not use an inner join? You can readily enough isolate those rows (perhaps with head and tail stages).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi Ray,

Thank you very much. I will go with the full outer join.

Regards,
Kumar
bachi
Participant
Posts: 28
Joined: Sun May 25, 2008 7:02 am

for header and trailer records

Post by bachi »

use Column export stage for this to get 21 fields
bachi
Participant
Posts: 28
Joined: Sun May 25, 2008 7:02 am

header and trailer records

Post by bachi »

and use funnel stage before column export
Post Reply