KeyMgtGetNextValue - Surrogate Key Generation

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
anupam
Participant
Posts: 172
Joined: Fri Apr 04, 2003 10:51 pm
Location: India

KeyMgtGetNextValue - Surrogate Key Generation

Post by anupam »

Hi All,

I am planning to use KeyMgtGetNextValue for generation of Surrogate Key in multiple Jobs simultaneously.

I want every Job to start the sequence number from 1 and then keep on incrementing. Can it be done using KeyMgtGetNextValue.

What is the best possible way to generate surrogate key in Server mode in multiple different Jobs simultaneously.
----------------
Rgds,
Anupam
----------------
The future is not something we enter. The future is something we create.
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

each key has a name. If you want to fill different keys you have to use different names. If you want to feed from the same sequence use same name.

Wolfgang
anupam
Participant
Posts: 172
Joined: Fri Apr 04, 2003 10:51 pm
Location: India

Post by anupam »

I have different Jobs ( J1 and J2)

And in each of the Jobs i want surrogate keys starting from 1 and getting incremented.
----------------
Rgds,
Anupam
----------------
The future is not something we enter. The future is something we create.
wnogalski
Charter Member
Charter Member
Posts: 54
Joined: Thu Jan 06, 2005 10:49 am
Location: Warsaw

Post by wnogalski »

For generating surrogate keys from one sequence simultaneously use KeyMgtGetNextValueConcurrent().
Regards,
Wojciech Nogalski
anupam
Participant
Posts: 172
Joined: Fri Apr 04, 2003 10:51 pm
Location: India

Post by anupam »

I want to start the Sequence Number from 1 in each case.
----------------
Rgds,
Anupam
----------------
The future is not something we enter. The future is something we create.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Then you may need to reset the sequence name(s) in a before-stage subroutine. Search the forum for "SDKSequences".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sandy
Participant
Posts: 24
Joined: Sun Feb 01, 2004 1:14 am

Post by sandy »

The sequences start with 1 and go on incrementing for each sequence name argument specified to this routine.
For Eg: KeyMgtGetNextValue('X') will start from 1 and so will KeyMgtGetNextValue('Y'). Then onwards each sequence shall go on incrementing by 1 for each call made to them. If you want to reset the sequence value you can use an UPDATE statement as below

UPDATE SDKSequences USING DICT VOC SET F1 = 'New Value' WHERE @ID = 'Name of the sequence';

Hope this helps.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

anupam wrote:I want to start the Sequence Number from 1 in each case.
Then it doesn't necessarily sound like you even need a Sequence number generator. Are you saying that you need to start them at 1 each time the job is run? If that's the case you could just use @INROWNUM.
-craig

"You can never have too many knives" -- Logan Nine Fingers
anupam
Participant
Posts: 172
Joined: Fri Apr 04, 2003 10:51 pm
Location: India

Post by anupam »

Thanks all for the Expert advice, Issue is resolved.
----------------
Rgds,
Anupam
----------------
The future is not something we enter. The future is something we create.
rumu
Participant
Posts: 286
Joined: Mon Jun 06, 2005 4:07 am

Post by rumu »

anupam wrote:Thanks all for the Expert advice, Issue is resolved.
Hi Anupam,
Can you please be specific how does yor problem get solved?Have u using update command to set SDK sequence or using @INROWNUM?
Post Reply