Hash Lookups and Transformers

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
jpr196
Participant
Posts: 65
Joined: Tue Sep 26, 2006 1:49 pm
Location: Virginia

Hash Lookups and Transformers

Post by jpr196 »

Hi all,

Maybe someone can help answer this question. Is it possible to return data from a Hash File where the keys are equal except the date where it is less than or equal to the date of the source? Or is my only solution to use bind variables and use user defined sql?

Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Is this date field part of the key? If no, then you can certainly do it by setting a constraint in a stage variable.
Something like

Code: Select all

IF NOT(REF.NOTFOUND) AND ref.DATE <= src.DATE then @TRUE else @FALSE
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Hash Lookups and Transformers

Post by ray.wurlod »

jpr196 wrote:Hi all,

Maybe someone can help answer this question. Is it possible to return data from a Hash File where the keys are equal except the date where it is less than or equal to the date of the source? Or is my only solution to use bind variables and use user defined sql?

Thanks
Not using a Hashed File stage.

Hashed File stage does not access the hashed file using SQL; instead it applies an algorithm to the exact key value. From that function it obtains the address of the record in question, and can retrieve it directly. This is very fast.

You can use SQL to access the contents of a hashed file if you use a UniVerse stage. Without any indexes on the hashed file, this promises to be very slow, particularly for other than "=" as your lookup condition.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jpr196
Participant
Posts: 65
Joined: Tue Sep 26, 2006 1:49 pm
Location: Virginia

Post by jpr196 »

Thanks for the input. The Date is part of the key so I'm guessing my best solution would be to use a drs stage directly for the lookup and compare the dates with user defined sql.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It will still be slow unless the column(s) named in the WHERE clause are indexed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

If you have only one or a few dates it may be wise to put the one date into a non-key-field (or the few dates as array into a non-keyfield) and make the compare in the next step.
Wolfgang Hürter
Amsterdam
Post Reply