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
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

lookup

Post by cosec »

Hi

(1)
Currently I have two relevant input columns attached to the Key expression columns of the lookup...and then I have a stage variable to check if they match or not and if successful to extract relevant fields from the lookup....for eg the check expression is :
If Input.Col1=Lkp.Col1 And Input.Col2=Lkp.Col2 Then 1 else 0

Is this correct ? and is there a better way to do it ?



(2)
My Lookup doesnt have any matches but I get a warning as follows:
Reference lookup generated 82 rows. Only the last row was used.
Do I need to check on anything ?

Thanks
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

There should be a match, and there is duplicate in lookup. Hence the warning.
NOTFOUND option could also be used as alternative.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

I verified the lookup data and there is no match.......also is my Q(1) correct ?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

cosec - how did you verify this? Since DataStage found 82 matches on the key you supplied, yet you are certain there are not matches you have eitehr got a problem with your logic or have discovered a bug in DataStage.
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

I created the lookup table with no match. Anyway when I chose the "generate sql" option it seemed to work right.....but doesnt for"Enter SQL"

I am doing a lookup on the database and not hash file.....by the way is it ok to do a lookup on the database it self without hashing ??

ArndW wrote:cosec - how did you verify this? Since DataStage found 82 matches on the key you supplied, yet you are certain there are not matches you have eitehr got a problem with your logic or have discovered a bug in DataStage.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What happens when you manually enter the SQL with the appropriate key inside your favorite SQL query tool - do you get no matches or 82?

You can lookup on the database and hashing doesn't apply in this context in server jobs (is this a server job?)
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

No Matches....OK thanks
ArndW wrote:What happens when you manually enter the SQL with the appropriate key inside your favorite SQL query tool - do you get no matches or 82?

You can lookup on the database and hashing doesn't apply in this context in server jobs (is this a server job?)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Your constraint expression is not correct. If the lookup fails, columns from Lkp will return NULL. Using NULL in a comparison is not defined. A better constraint expression would be Not(IsNull(Lkp.Col1)).
You don't need to check Col2, and you don't need to check that the returned values are the same as the stream input values - they must be if these are the reference keys.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply