Joins with Hash

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
pkl
Participant
Posts: 50
Joined: Wed Aug 11, 2004 11:45 am

Joins with Hash

Post by pkl »

Hi All,

I want to do a join on a table with a hash file. I have to join using 3 fields from the hash. While joining I shud be able to check whether the column I am joining with, has any data or not. If there is no data in that column then I have to join it with a default value.


I am facing difficulty in implementing this. Can anyone help me out with this.


Thanks
Preethi
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,
I don't think you can use hash file this way.
HAsh Files are generally used as lookup and you cannot use any relational operators on it.


Ketfos
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

But you can use an expression in the Key value field. A simple If-Then-Else expression can put the link data into the key if is "not empty", otherwise it can use a default value to do the lookup.

Or you could do this in two lookups to the same hash, one using row data in the keys and one using defaults. Use the first results if the lookup succeeds, or use the second results if the first lookup fails.

Depends on how you need to handle your defaults.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mayank007
Participant
Posts: 8
Joined: Thu Sep 30, 2004 5:16 pm
Location: California

Re: Joins with Hash

Post by mayank007 »

pkl wrote:Hi All,

I want to do a join on a table with a hash file. I have to join using 3 fields from the hash. While joining I shud be able to check whether the column I am joining with, has any data or not. If there is no data in that column then I have to join it with a default value.


I am facing difficulty in implementing this. Can anyone help me out with this.


Thanks
Preethi
You could use a If-Then-Else Construct while joining the input columns to the hash file fields within the transformer. This way the logical flow could be controlled.
pkl
Participant
Posts: 50
Joined: Wed Aug 11, 2004 11:45 am

Post by pkl »

Hi ,

Thanx a lot for your help. I'll try it out now. I greatly appreciate your help


Preethi
Post Reply