Page 1 of 1

Join Header and Tralier

Posted: Thu May 29, 2008 6:41 pm
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

Posted: Thu May 29, 2008 9:37 pm
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:

Posted: Thu May 29, 2008 11:09 pm
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.

Posted: Fri May 30, 2008 12:02 am
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.

Posted: Fri May 30, 2008 1:37 am
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.

Posted: Fri May 30, 2008 2:43 am
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.

Posted: Fri May 30, 2008 6:37 am
by ray.wurlod
Or, indeed, in an External Source stage.

Posted: Fri May 30, 2008 8:24 am
by ameyvaidya
ray.wurlod wrote:Or, indeed, in an External Source stage. ...
Whoops!!! :oops: Typo!!!

Thanks Ray.. thats what I meant to say!!!

Posted: Fri May 30, 2008 11:53 am
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

Posted: Fri May 30, 2008 4:10 pm
by ray.wurlod
Yes, but why not use an inner join? You can readily enough isolate those rows (perhaps with head and tail stages).

Posted: Fri May 30, 2008 6:31 pm
by kumar66
Hi Ray,

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

Regards,
Kumar

for header and trailer records

Posted: Sat May 31, 2008 7:13 am
by bachi
use Column export stage for this to get 21 fields

header and trailer records

Posted: Sat May 31, 2008 7:15 am
by bachi
and use funnel stage before column export