initialize a hash file using a parameter

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
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

initialize a hash file using a parameter

Post 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 ...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
Last edited by ray.wurlod on Wed Jun 07, 2006 4:03 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post by kjaouhari »

Ok I keep sequential file in input
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post by kjaouhari »

Do you know an other way to initialyze manually a hash file ?
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post 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 ....
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Post 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
Rob Wierdsma
Toronto, Canada
bartonbishop.com
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post 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...
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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,
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why use a seq file? Start the job from the transformer and constrain the output to one row.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post by kjaouhari »

Because during compilation I have the error message :

Stage doesn't have primary input
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Add a stage variable. No need to use it but it will make the compiler happy. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

Post by kjaouhari »

:P Thanks very much chulett and all !! it works very good !!

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

Post by ray.wurlod »

And isn't that what I initially recommended? :roll:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yup. :lol:
-craig

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