Merge 2 different files

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Merge 2 different files

Post by kjaouhari »

Hello all,

I want to merge 2 files. The first contains Header and second contains the details.

When I compile job, I have an error message : "Link Collector stage must have the same number of columns on all of its input and output..."

So shoud I use an other stage to merge 2 files ?

thanks for your help dsxians !
boppanakrishna
Participant
Posts: 106
Joined: Thu Jul 27, 2006 10:05 pm
Location: Mumbai

Post by boppanakrishna »

hi,
if you want to use Link Collector or Link Partitioner the metadata must be same in both the input and output files ..

For merging the two files you can use Merge stage,

if you have any queries regarding this you are always welcome

Thanks
Boppana Ramakrishna
ShaneMuir
Premium Member
Premium Member
Posts: 508
Joined: Tue Jun 15, 2004 5:00 am
Location: London

Post by ShaneMuir »

Can't you just use a unix command in a before or after subroutine?

eg cat detail.txt >> header.txt
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post by kjaouhari »

Thanks for your ideas,

but with your methods I think I can't have a file with this structure:

header 1
ligne 1
ligne 2
header 2
ligne 1
ligne 2
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

What are contents of input header file and detail file?

To understand the output mentioned in your post, input should be specified.
Regards,
S. Kirtikumar.
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post by kjaouhari »

Header file contains description and details contains amount.

I've found a dirty solution : I use other transformer before link collector to set the same columns number :
NumHeader-NumLigne-Content
ShaneMuir
Premium Member
Premium Member
Posts: 508
Joined: Tue Jun 15, 2004 5:00 am
Location: London

Post by ShaneMuir »

kjaouhari wrote:Thanks for your ideas,

but with your methods I think I can't have a file with this structure:

header 1
ligne 1
ligne 2
header 2
ligne 1
ligne 2
Is there any link between the header and the detail? ie So you know which detail lines belong to which header, or is it just write header, 2 detail lines, header, 2 detail lines etc?
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Converting into single large varchar column before Link Colelctor might also help.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply