Page 1 of 1

Hash Logic

Posted: Sun Apr 10, 2005 10:10 pm
by rcil
Hello All,

Here I am trying to understand a previous built job. what results do I get when I have two output links with different transformations writing to a single hash file with single key? On what situations do we use this kind of logic?

If we check only the 'Clear File before writing' and uncheck the 'create file' options on the hash file stage, will these options create a hash file? or is it must that 'create file' option should be checked to create hash?

thanks

Re: Hash Logic

Posted: Sun Apr 10, 2005 11:21 pm
by chulett
rcil wrote:If we check only the 'Clear File before writing' and uncheck the 'create file' options on the hash file stage, will these options create a hash file? or is it must that 'create file' option should be checked to create hash?
Clearing the file before writing has no bearing on whether it gets created or not. Think of it as a 'truncate' for the hash file.

Hash files will get created regardless of whether you have the 'Create File' option checked or not. If it doesn't exist when it goes to write to it, DataStage will create it. What you buy when you enable it is the 'Options' that come along for the ride. If you don't use or change a single option, then don't bother to check the create file box. Once you do, however, you can change the type from its default of 30, increase the Minimum Modulus to 'presize' it, or delete the hash and recreate it every run of the job - amongst other things.
Here I am trying to understand a previous built job. what results do I get when I have two output links with different transformations writing to a single hash file with single key? On what situations do we use this kind of logic?
What do you get? The classic hash file answer - destructive overwrite, so last one in wins. In what situations would you do this? Can't really say, hopefully ones where that makes sense. :wink:

Posted: Mon Apr 11, 2005 2:23 am
by ArndW
rcil,

in addition to what Craig stated, I would just ask that you make sure that both links are actually writing to the same file. Two links going into the same HASH stage don't mean that they are writing to the same file. I've made that mistake before (more than once). Just food for thought...

Posted: Mon Apr 11, 2005 8:12 am
by chulett
Very true! Two links into one stage doesn't mean that they write to the same hash. All it guarantees is they live in the same account or are pathed in the same directory.