merge data from two files
Posted: Wed Feb 09, 2005 8:41 am
hi, i have two files f1 and f2 which looks like this.
f1
c1,c2, ..
100,1,..
100,2,..
100,3,..
200,1,..
200,2,..
300,1,..
and f2
c1,c3,..
100,1000,..
100,2000,..
300,1000,..
300,2000,..
the output file should be
c1,c2,c3,
100,1,1000,..
100,2,2000,..
100,3,NULL,..
200,1,NULL,..
200,2,NULL,..
300,1,1000,...
300,NULL,2000,..
As you can see the data from the two files have to be 'merged' together. How ever i try with hash files i end up having something like a cartesian product. Would it be possible to do it DS. The c3 column in f2 file will have only 2 values 1000,2000 if that will help.
f1
c1,c2, ..
100,1,..
100,2,..
100,3,..
200,1,..
200,2,..
300,1,..
and f2
c1,c3,..
100,1000,..
100,2000,..
300,1000,..
300,2000,..
the output file should be
c1,c2,c3,
100,1,1000,..
100,2,2000,..
100,3,NULL,..
200,1,NULL,..
200,2,NULL,..
300,1,1000,...
300,NULL,2000,..
As you can see the data from the two files have to be 'merged' together. How ever i try with hash files i end up having something like a cartesian product. Would it be possible to do it DS. The c3 column in f2 file will have only 2 values 1000,2000 if that will help.