Join Stage

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
pp
Participant
Posts: 27
Joined: Tue Apr 03, 2007 8:50 pm

Join Stage

Post by pp »

I have 2 inputs A and B which go through a join component.
Input A
Column Name : num_rec
Data : 000123

Input B
Column Name : num_rec
Data : 000129

In my Join Component, my key is num_rec and I have specified an outer join type because in the output I want to see data from both the files. But I cannot.
I have 2 output colums num_rec_input and num_rec_ctl.

I tried putting a peek after the join and before the output file to see the data flowing and I saw the following:

Output C
num_rec_input :000123
num_rec_ctl :000000

I want to see the 000129 in the num_rec_ctl column. How can I achieve this?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Have you tried declaring a column called "Data" as an output of your join?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If num_rec is your join key you will NEVER see 000129 in a left outer join. In a left outer join you will only see matching key values (000123) or NULL.
This is the definition of a left outer 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.
mcs_murali83
Participant
Posts: 23
Joined: Sat Sep 29, 2007 6:05 am
Location: Datastage
Contact:

Hai

Post by mcs_murali83 »

Hai,

In case of join stage, meta data must be same. If we want to join two or more tables, we need a key column must be identical in all the tables. Then it works fine for you. Another use of join stage, it combines the data in sets.
Murali
mcs_murali83
Participant
Posts: 23
Joined: Sat Sep 29, 2007 6:05 am
Location: Datastage
Contact:

Hai

Post by mcs_murali83 »

Hai,

In case of join stage, meta data must be same. If we want to join two or more tables, we need a key column must be identical in all the tables. Then it works fine for you. Another use of join stage, it combines the data in sets.
Murali
pp
Participant
Posts: 27
Joined: Tue Apr 03, 2007 8:50 pm

Post by pp »

ray.wurlod wrote:If num_rec is your join key you will NEVER see 000129 in a left outer join. In a left outer join you will only see matching key values (000123) or NULL.
This is the definition of a left outer ...
I am using a full outer join.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

Are you expecting to see 1 record as output? If you are using a full outer join with 2 different key values (123 and 129) I would imagine you would get 2 output records - they don't join, so you couldn't get them on the same record.

What exactly are you trying to achieve? How are 123 and 129 supposed to look on the output?

Think about how you would do this in a SQL query, because the joins in DataStage mimic that. Sometimes putting it in a different context can help figure out what you intend, and then you simply convert it into a DataStage join.

Brad.
pp
Participant
Posts: 27
Joined: Tue Apr 03, 2007 8:50 pm

Post by pp »

bcarlson wrote:Are you expecting to see 1 record as output? If you are using a full outer join with 2 different key values (123 and 129) I would imagine you would get 2 output records - they don't join, so you couldn't get them on the same record.

What exactly are you trying to achieve? How are 123 and 129 supposed to look on the output?

Think about how you would do this in a SQL query, because the joins in DataStage mimic that. Sometimes putting it in a different context can help figure out what you intend, and then you simply convert it into a DataStage join.

Brad.
Actually I am expecting two records but I am getting only 1 record.
craviraj
Participant
Posts: 17
Joined: Mon Jun 12, 2006 5:17 am
Location: Secunderabad

Post by craviraj »

I was sure that the output would be 2 records. Still for it, I just tried a sample to check and I got the output as desired.

pp, you probably need to check that you have done a 'sort' and 'hash' on keys. As others have suggested, please check for the column names 'coz column should match exactly.

~ R-Square
Post Reply