how to retrive unmatching records from 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
suma
Participant
Posts: 32
Joined: Fri Jun 11, 2004 8:18 am

how to retrive unmatching records from lookup

Post by suma »

Hi all,
I have a problem with lookup.
In the source say i have 5 records,But in the Look up i have only 3 matching records.When i make a loop up i get the records that are matching. To get the records that are not matching i give the condition in the constrains IsNull(DSLink.1) where DSLink1 is the lookup link.
But everytime i do i get only 0.No records are loaded for the unmatching records.

Help me ut to solve this problem
anitha_casturi
Participant
Posts: 21
Joined: Wed Jun 30, 2004 3:48 am

Post by anitha_casturi »

Ideally IsNull(DSLink.1) should work.
Why not try ISNULL(match column) and check????
MaheshKumar Sugunaraj
Participant
Posts: 84
Joined: Thu Dec 04, 2003 9:55 pm

Post by MaheshKumar Sugunaraj »

Hi,

You could try the following:

hashfile_lookup.NOTFOUND in the constraint.

Should work.

Thanks & Regards
Mahesh
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

If I've understood your problem: you want to obtain the records in your lookup file that do not exist in your stream input file. You will have to rethink your design strategy. A reference lookup is essentially a left outer join between your stream input and your reference input. It sounds like you're looking for a full outer join solution.

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

Post by ray.wurlod »

Re-read what you asked, which Mike has highlighted. The purpose of a lookup is to find what's there. If it's not there you can't find it! Therefore there will be no "unmatching records".

As Mike said, it appears that you're seeking to perform a full outer join (or union); all values irrespective of source. If both sources are in the same database the easiest way to do this is with SQL (either a full outer join query or a union query).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
changming
Participant
Posts: 68
Joined: Wed Oct 13, 2004 3:35 am

look up work?

Post by changming »

look up can solve this problem, i think,
a lookup will find what is match, if not find, return null. so you capture the null value, instead of not null value.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Did you build your constraint expression using the expression editor or by manual typing?

The IsNull() function must apply to the key column on the reference input link (the lookup) - for example IsNull(DSLink1.keycolumn)

Your original request suggested that you may not have this totally correctly specified.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mandyli
Premium Member
Premium Member
Posts: 898
Joined: Wed May 26, 2004 10:45 pm
Location: Chicago

Post by mandyli »

Hi

As ray said for retrieving unmatched records use Join stage(left outer Join). Lookup stage used for chekcing any match value is there in table or file.

please try use join stage.


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

Post by chulett »

mandyli wrote:please try use join stage.
:? Doesn't really help telling someone to use a PX stage for a Server job.

I think we're at the point in this thread where we need to wait for the OP to come back and comment on all the wonderful advice here. Otherwise, we're just talking to ourselves. :wink:
-craig

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