Inverse Hash File 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
kadf88
Charter Member
Charter Member
Posts: 77
Joined: Wed Jan 25, 2006 10:15 am

Inverse Hash File Lookup?

Post by kadf88 »

I have a flat file full of rows and a hash file that i want to do an inverse lookup against. That is, normally, a hash file servers to lookup keys but in this case I want to filter out all the rows in my flat file that do not exist in the hash file.. how do I do this without using reject rows option?

thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You still should load you hashed file to memory and lookup each row, but instead of using a reject link just put a RefLink.NOTFOUND constraint on your output.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

When you mean filter out, I am assuming that you want only those records in your output from your flatfile whose corressponding rows exist in the hashed file( or as you said you dont want records in your output from your flatfile which dont have a corresponding row in the hashed file). In that case, a normal lookup against the hashed file based on the key column should yield the desired results. I hope I understood your problem correctly. If not, please let me know.

Thanks
Kris
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: Inverse Hash File Lookup?

Post by DeepakCorning »

Add a stage variable which will act like a flag and will be set depending on the row is found in the hashed file or not and add a constraint depending on the flags value.
kadf88
Charter Member
Charter Member
Posts: 77
Joined: Wed Jan 25, 2006 10:15 am

Re: Inverse Hash File Lookup?

Post by kadf88 »

DeepakCorning wrote:Add a stage variable which will act like a flag and will be set depending on the row is found in the hashed file or not and add a constraint depending on the flags value.
yeah, but what kind of stage variable allows me such an ability to detect whether the row is detected or not?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The one I mentioned earlier, use Reflink.NOTFOUND builtin value.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

See Arnd's reply, or simply check if any of the matching key column values in the hashed lookup are not null. To achieve the effect of an "inner join" you need to use a constraint that verifies if the lookup row is present. An "outer join" doesn't require a constraint, DS is ambivalent to whether the lookup exists.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
dylsing
Participant
Posts: 35
Joined: Thu May 04, 2006 9:56 pm

Post by dylsing »

ArndW's suggestion will work

Assuming your lookup is called LKP, use the LKP.NOTFOUND directly in the constraint itself within the transformer, so that whatever rows are not found in the hash will be allowed to the next stage in the transformer.

Hope I made sense in that mouthful. :)
Post Reply