Lookup

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
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Lookup

Post by adams06 »

Hi all,

My job looks like


lookup
|
|
source--------------->x---------->target

In my source data

column (A)

10
20
30

Look up data
column(A) column(B)

10 name1
10 name2
10 name3
20 name1
20 name2
20 name3

My problem is when i do a look up i am getting only one record from the look up, But i am supposed to get all the records related to 10( as there are unique), similarly for 20.

any idea.


Thanks in Advance
Last edited by adams06 on Tue Nov 14, 2006 7:23 pm, edited 1 time in total.
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post by bchau »

In DS SE, you can only do this if the reference is an ODBC stage. It's been a while since I have done it, but I believe that the Server Job Developer's guide has details on how to do it (look for "Multirow Lookup for Reference Inputs").

The easier way to do it would be an SQL User defined query in your source stage (Using a Join).
ShaneMuir
Premium Member
Premium Member
Posts: 508
Joined: Tue Jun 15, 2004 5:00 am
Location: London

Post by ShaneMuir »

If your lookup is a hash file you can use a UV stage to bring back multiple rows (I think). Never actually done it myself, but I am sure I have seen many postings about it on the forum.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's right, multi-row return from reference lookup is supported in ODBC and UV stage types. Search the forum or consult on-line help for more information.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, you can. It's a wee bit of a PITA but it certainly can be done. There are many postings with the gory details - VOC record, CREATE.INDEX, BUILD.INDEX, creating a hashed file versus a UV table, composite index versus multiple singleton indexes, yada yada yada. :?

I avoid the need to do that unless you absolutely cannot find another way to implement it.
-craig

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