Lookup Key Expression

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
Billyqing
Participant
Posts: 44
Joined: Thu May 13, 2004 12:00 pm
Location: Canada

Lookup Key Expression

Post by Billyqing »

simple lookup is equal join for Primary input with look up keys.

Is any way to lookup with non-equaljoint expression?

For example:

in primary input:

EmpNo Salary
1001 4550.55


in Reference input
Sal_level FromSal EndSal
1 1000.00 1999.99
2 2000.00 2999.99
3 3000.00 3999.99
4 4000.00 4999.99
............

Output should be:

EmpNo Salary Sal_level
1001 4550.55 4

Anyone knows how to do so?

Thanks in advanced

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

Post by chulett »

Only pass along the hashed lookup failures? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Isnt this a duplicate post :?
Use a temp table to load your hashed file into it and use the sql mentioned in your otherpost.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yah, noticed that after I posted here. However, I didn't notice the '4' in the output... and what the OP is looking for is specifically a 'range lookup' rather than a 'non-equaljoint' one.

Ken Bland posted a way to do this in hashed files which I've leveraged in the past. Not for the faint of heart, but does work rather nicely. :lol:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Billyqing
Participant
Posts: 44
Joined: Thu May 13, 2004 12:00 pm
Location: Canada

Post by Billyqing »

Hi Raig,

Yaeh, you can say it is a 'Range Lookup'. I am looking for any way instead of put everything together into DB, then use SQL.

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

Post by chulett »

Ken Bland posted these routines back in 2003 to do ranged lookups in hashed files. Only 'problem' is they are considered Premium Content now, but I'm sure you could contact Ken directly as all of his stuff is 'open source' I do believe. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply