Page 1 of 1

initialize a hash file using a parameter

Posted: Wed Jun 07, 2006 2:04 am
by kjaouhari
Hi Guys and Miss !

My question is what is the best practice to initialize a hash file ?
This Hash file is using to keep a sequence number. But Sometimes we want to initialize this sequence number.

I create a different job just for the initialzation (I don't want to enable the initilization in the daily job)

I Use a transform with parameters, all is fine but the transform need and input link. Is it possible to disabled the input link of the transformer or something else ?

Currently I have an dummy input sequential file in order to run correctly the job but I think it isn't the better way ...

Posted: Wed Jun 07, 2006 2:24 am
by ray.wurlod
There's no real best way.

A job that consists of a Transformer stage followed by a Hashed File stage would do it. Use a stage variable to "calculate" the initial value, and the job parameter (List type, values 0 or 1, default 0) used to constrain the output, along with @OUTROWNUM = 1. On the output link are two columns; sequence name and sequence value (however these are named in the hashed file).

Note that it's "hashed" file, not "hash" file. It's a file that uses a hashing algorithm to determine the physical location of records based on their key value.

Posted: Wed Jun 07, 2006 3:26 am
by kjaouhari
Ok I keep sequential file in input

Posted: Wed Jun 07, 2006 3:51 am
by kjaouhari
Do you know an other way to initialyze manually a hash file ?

Posted: Wed Jun 07, 2006 4:07 am
by kjaouhari
Because currently if the dummy input sequential file is empty then I have no output rows.

If I have 3 input rows then I have 3 output rows.

But I want just to update one row in hash file

This is why I looking for an other way ....

Posted: Wed Jun 07, 2006 10:07 am
by rwierdsm
If your input file is a dummy file and you only want 1 row to be sent to the hashed file, why would you have 3 records in the input dummy file.

Sorry, but I think we need some more info....

Rob

Posted: Wed Jun 07, 2006 10:31 am
by kjaouhari
It's just an example,

I set a dummy sequential file and I know that I just need one row.

But If someone else, like a new datastage developper, want to run this job I think he'll not understand why I set this dummy file.

This is why I'm looking for a more simply solution and with more maintainability. In fact if we forgot to create this dummy file after a migration the job will abort...

Posted: Wed Jun 07, 2006 10:37 am
by DSguru2B
You can access the hashed file by universe stage, if its in the project account offcourse, and do a sql update to it.
As far as your concern for a new developer goes, use the annotation. I promise Ascential wont charge you for that :twisted:
Infact, use annotations as much as you can. Always presume that you need to spoon feed the other developer who is going to take over later on. Helps in maintaining and enhancing the jobs.
Regards,

Posted: Wed Jun 07, 2006 10:48 am
by chulett
Why use a seq file? Start the job from the transformer and constrain the output to one row.

Posted: Wed Jun 07, 2006 12:04 pm
by kjaouhari
Because during compilation I have the error message :

Stage doesn't have primary input

Posted: Wed Jun 07, 2006 12:13 pm
by chulett
Add a stage variable. No need to use it but it will make the compiler happy. :wink:

Posted: Wed Jun 07, 2006 1:14 pm
by kjaouhari
:P Thanks very much chulett and all !! it works very good !!

see you :wink:

Posted: Wed Jun 07, 2006 4:02 pm
by ray.wurlod
And isn't that what I initially recommended? :roll:

Posted: Wed Jun 07, 2006 4:25 pm
by chulett
Yup. :lol: