Dymanic update of parametres/variables

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ktweedly
Participant
Posts: 17
Joined: Wed Jun 25, 2008 8:56 am

Dymanic update of parametres/variables

Post by ktweedly »

I am looking for a way to dynamically update parameters in DS 7.5.1.

Here is the scenario:

In my sequence the first job selects max(key). I need to pass the value to the next job and plug it into a surrogate_key_generator to provide the starting value.

If I use a stage variable I can't pass it to the next job. I need to get the value into a parameter that the SKG stage can understand.

I am not talking about parameters on the command line.

I need to get the value returned from the select into a "sequencer level" parameter that will be available to all jobs in the sequence.

I have perused many forums and all I have found are allusions to params on the command line or 'you can't do it'.

I refuse to believe that such a simple concept is not doable in DS.

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

Post by DSguru2B »

Well it is certainly doable.
Let the first job be a server job that gets the max and stores it in the USER Status of the job. (Search the forum on how to do that)

Write a simple three/four liner server routine that gets this value back(Again search for it, i have seen it on the forum).

In the derivation portion of parameters of the job activity that calls your parallel job, call the server routine. This way the value will be populated during run time.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
velagapudi_k
Premium Member
Premium Member
Posts: 142
Joined: Mon Jun 27, 2005 5:31 pm
Location: Atlanta GA

Post by velagapudi_k »

I have done this before. Write the max surrogate key in to a flat file. The flatfile will have onlt one value. Write a routine to read the value from file.
The job that follows next will get the key from 'routine.returnvalue'
Venkat Velagapudi
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

I have a blog post on the same - Surrogate Key Generation in DataStage - An elegant way. If you know to use DataStage Job Control Interfaces specified in Advanced developer guide this will be really helpful.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

-craig

"You can never have too many knives" -- Logan Nine Fingers
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ktweedly
Participant
Posts: 17
Joined: Wed Jun 25, 2008 8:56 am

Post by ktweedly »

I have created the routine to set $Userstatus. It compiled and tested OK. When I try to use it in the column derivation (per the posts) it stays red (Variable 'userstatus' not defined).

Am I doing something wrong?
Keith Tweedly
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

There has to be two routines. One to SET it (which you already have). A second one that GETs the value from the user status. And the second routine needs to go in the derivation.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply