merging two files with different metadata

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
vinodhraj
Participant
Posts: 53
Joined: Mon Sep 12, 2005 6:51 am

merging two files with different metadata

Post by vinodhraj »

Hi,

Is it possible in Datastage to merge files with different metadata having common key columns?

Thanks

Vinod
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Re: merging two files with different metadata

Post by balajisr »

vinodhraj wrote:Hi,

Is it possible in Datastage to merge files with different metadata having common key columns?

Thanks

Vinod
Use Merge stage.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Either you can use merger or lookup based on the volume of data. Since your concertn is on metadata, I guess you are on Concatination, if so just use cat file1 file2 > new filename command in any of the unix command execution option, like Execute command activity or Before/After job subroutine.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
changming
Participant
Posts: 68
Joined: Wed Oct 13, 2004 3:35 am

why you do that

Post by changming »

cat two file. but why you do that? how do you deal with a file with two parts of different meta data?
vinodhraj
Participant
Posts: 53
Joined: Mon Sep 12, 2005 6:51 am

Post by vinodhraj »

Thanks.

I am working with datastage server jobs, I can't use merge stage in server since I have to mention different key name for the same column.

Is it possible in unix ?

Somehow I have done this using Set Operators in SQL..

I didn't prefer lookup becoz, there is no relation between these tables though the column name were same.

Moreover SET Operators were better in performance wise.

Thanks

Vinod
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If there is no relationship between two table, how can you merge two table without cartision product.
Can you explain your need with some example?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
vinodhraj
Participant
Posts: 53
Joined: Mon Sep 12, 2005 6:51 am

Post by vinodhraj »

Kumar,

Using Union we can do this i.e if the column name is similar.

Since I am joining with differnent metadata, which ever metadata is mismatching, I will mention them as empty string providing common alias name.

for eg:

table a

name
deptno
sal


table b

name
deptname

select name, deptno,to_char(sal),'' deptname from table a
union all
select name, '' deptno,'' sal,deptname from table b


hope it helps

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

Post by ray.wurlod »

vinodhraj wrote:I am working with datastage server jobs, I can't use merge stage in server since I have to mention different key name for the same column.
Vinod
This is not correct. The column names (when working with sequential files) are totally irrelevant. Adjust the metadata so that you do have a common key column name.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Using transformer, you can create columns with empty strings to match the metadata. Or use script for the same purpose. 'Cat' the two files.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

cat is NOT the same as join.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

cat is synonymous to union.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Neither is cat synonymous to UNION. A UNION removes duplicates; cat does not. Nor is UNION a join.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Actually i mean UNION ALL. Cat is synonymous to UNION ALL. And yes my statement above doesnt hold true as UNION does remove duplicates. For some reason i left out the 'ALL'. :oops:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Learn not to rush, grasshopper. :D
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well caught. :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply