Creating/updating an unique number for each call of the sequ
Moderators: chulett, rschirm, roy
Creating/updating an unique number for each call of the sequ
I would like to create an unique if for each to my sequencer. I'll be creating a data set file which will initially have 1 value of 0. For every call of the sequencer, it'll be incremented by 1. I thought of a initialization job
which will create the file with 0 value first. I'll have another job which will read and update the dataset. This second job will be the first thing called in the sequencer.
I would like to hear other ideas if anybody has any. Thanks.
which will create the file with 0 value first. I'll have another job which will read and update the dataset. This second job will be the first thing called in the sequencer.
I would like to hear other ideas if anybody has any. Thanks.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You could use either of the SDK Key Management routines invoked via a Routine activity. These emulate a sequence in a database; the next value self-initializes to 1 on the first call, and otherwise is preserved in a record (whose key is the sequence name) in a Repository table called 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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Two methods: set the ID in each sequence job or set it in the sequence job that calls other sequence jobs.
Use a User Variables stage as this is a good way to organise your sequence job code. Inside this stage create a new user variable and in the derivation field call the SDK key routine, passing a code that is unique for each sequence job, and you will get a unique code back again. The routine will handle the retrieval, incrementing and saving of the codes.
Sequence jobs call both parallel and server jobs, most of the entry fields in sequence jobs accept DataStage BASIC code. This lets you call SDK routines from within stages like the User Variables stage.
Use a User Variables stage as this is a good way to organise your sequence job code. Inside this stage create a new user variable and in the derivation field call the SDK key routine, passing a code that is unique for each sequence job, and you will get a unique code back again. The routine will handle the retrieval, incrementing and saving of the codes.
Sequence jobs call both parallel and server jobs, most of the entry fields in sequence jobs accept DataStage BASIC code. This lets you call SDK routines from within stages like the User Variables stage.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
vmcburney, thank you for your response. I wanted to know where I can read up more about SDK sequences. I couldn't find it in the PDFs.
I have only 1 sequence job (I call it sequencer). This job ties together all my jobs. I'll be calling this sequence job multiple times for different data files and I need to keep track of which file is associated with which call. That's why I need a unique number for each call be stored somewhere that can be tracked.
I have only 1 sequence job (I call it sequencer). This job ties together all my jobs. I'll be calling this sequence job multiple times for different data files and I need to keep track of which file is associated with which call. That's why I need a unique number for each call be stored somewhere that can be tracked.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
This works. I used KeyMgtGetNextValueConcurrent("MySeqName"). But here is the problem. Is there any way to reset the value to start from a certain value? I know that it stores this value internally.
I can probably write a routine using the KeyMgtGetNextValueConcurrent routine. Any ideas/comments would be appreciated.
I can probably write a routine using the KeyMgtGetNextValueConcurrent routine. Any ideas/comments would be appreciated.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 26
- Joined: Fri Feb 27, 2004 7:23 am
- Location: WI, USA
You can reset the value by the using the following:splayer wrote:This works. I used KeyMgtGetNextValueConcurrent("MySeqName"). But here is the problem. Is there any way to reset the value to start from a certain value? I know that it stores this value internally.
I can probably write a routine using the KeyMgtGetNextValueConcurrent routine. Any ideas/comments would be appreciated.
InitializeKey("Your_Key", 0)
You can place any number where I have placed the zero
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Charter Member
- Posts: 9
- Joined: Mon Sep 25, 2006 12:54 pm
- Location: US
sdksequences
my 2 cents
in our application, we have used the keymgtGetnextvalue , but
the key and value are stored in an hashed file
can some one explain what is better, using a table inside Datastage ( I do not know anything about it ) or a hashed file
thanks
Praveen
in our application, we have used the keymgtGetnextvalue , but
the key and value are stored in an hashed file
can some one explain what is better, using a table inside Datastage ( I do not know anything about it ) or a hashed file
thanks
Praveen