Join stage: Need to retain the column key from both tables

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
pdntsap
Premium Member
Premium Member
Posts: 107
Joined: Mon Jul 04, 2011 5:38 pm

Join stage: Need to retain the column key from both tables

Post by pdntsap »

Hello,

I have a join stage joining data from Table A and Table B based on join key Column A. Is there a way by which Column A from both Table A and Table B can be retained at the output of the Join stage?

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

Post by ray.wurlod »

Yes. Make an additional column in Table B that is a copy of the key and map that to the output.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pdntsap
Premium Member
Premium Member
Posts: 107
Joined: Mon Jul 04, 2011 5:38 pm

Post by pdntsap »

That was quick, Ray.

My inputs are flat (sequential) files and not tables as previously mentioned. Sorry about that. I used a Copy stage after the Sequential file stage to create an additional column that will be a copy of the key column but it looks like the same input column cannot be mapped to more than one output column in the Copy stage. I used a Transformer stage after the Sequential file stage and was able to create a copy of the key column. It seems to be fine but I need to some more testing and will update my post again.

Thanks again.
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Re: Join stage: Need to retain the column key from both tabl

Post by BI-RMA »

Hi pdntsap,

I can't see why You are interested to see the content of the join Column A from table B when they are (by definition) identical (in inner and left outer joins). You can always map the key value to multiple output fields after the join by using a copy stage.

DataStage will , however, provide the key-columns from both tables when using full outer join mode (which makes a lot of sense).
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
pdntsap
Premium Member
Premium Member
Posts: 107
Joined: Mon Jul 04, 2011 5:38 pm

Post by pdntsap »

Roland,

The join stage uses inner join and I need the key columns from both inputs for further processing downstream. Thanks for your suggestion of copy stage after the join stage. I believe copy stage might lead to better performance (in terms of processing time) than a transformer stage.
Post Reply