range lookup

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
sigma
Premium Member
Premium Member
Posts: 83
Joined: Thu Aug 07, 2008 1:22 pm

range lookup

Post by sigma »

I have a problem using range option in the Lookup stage.

I need to perform Lookup for the combination of 2 fields:

Field1 Comp_Code - one to one lookup
Field2 ACCT - range lookup (=>ACCT_from, =<ACCT_to)

The stage does not let me to include ACCT_from and ACCT_to to the key.

Here is the situation that creates a problem - same comp code for two different ranges:

Code: Select all

ACCT_from   ACCT_to   Comp_Code
000000	    299999	    1850
400000	    999999	    1850
When I run the process it picks up only first occurrence of 1850 and ignores the second, third ...

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

Post by ray.wurlod »

Looks like you've tried to create a range lookup on the stream input. Try creating the range lookup on the reference input.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do you have the "return multiple rows from reference link" option selected?
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 »

However, that's not an example of "multiple ranges" as your input data only qualifies for one range in your example. It's not about how many you have to check.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: range lookup

Post by chulett »

sigma wrote:The stage does not let me to include ACCT_from and ACCT_to to the key.
Help us with what that means. You should certainly be able to bind your one input column to both of the lookup columns... what is in your 'range expression'?
-craig

"You can never have too many knives" -- Logan Nine Fingers
sigma
Premium Member
Premium Member
Posts: 83
Joined: Thu Aug 07, 2008 1:22 pm

Post by sigma »

ray.wurlod wrote:Do you have the "return multiple rows from reference link" option selected?
Option "return multiple rows" helped! Thank you very much!!! :D
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Confused as to how that actually fixed the problem as there was no need to return multiple anything in the example given, just one. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
djbarham
Participant
Posts: 34
Joined: Wed May 07, 2003 4:39 pm
Location: Brisbane, Australia

Post by djbarham »

chulett wrote:Confused as to how that actually fixed the problem as there was no need to return multiple anything in the example given, just one. :?
Thanks guys, this thread helped me too.

Craig, I agree with your confusion. I have the same situation where I have 2 columns with an equality match on the lookup, the one column on the input stream that matches on a range in the lookup link.

One clue was the following error in the job log:

Code: Select all

lu_match_current_records,0: Ignoring duplicate entry; no further warnings will be issued for this table
While the ranges mean that we don't have multiple rows matched for any input, the definition of the lookup link only has the equality matched fields tagged as key fields. So, in terms of the fields identified as key fields, yes, there are multiple matches, but the range sorts it out.

I'm inclined to call it a bug (or at least a trap for young players).

Thanks to Ray for the answer (again).
Post Reply