Generate unique ID in sequence for each run of a job

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Generate unique ID in sequence for each run of a job

Post by chetan.c »

Hi,

I need to generate a run id for each run the of the job.
For the next run the value must be incremented.

The approach i know is storing the value in the table and calling select max query in unix script and extract that data in User variables and use it in job as job parameters.

Is there any other approach apart from it?

Thanks,
Chetan.C
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No really. It must be stored somewhere, incremented and then passed to (or fetched by) any job that needs it. Not sure that the nuances of each step really change that basic fact.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Post by chetan.c »

Hi Craig,

What is the best way to do this?
I do not have the freedom to save in any table so i have to store this value on file system.
This file needs to be update after each run and the next run must Pick up this value+1.

How can I implement it?

Regards,
Chetan.c
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Does each job need to maintain a unique sequence for itself, or do you need one sequence that is used across all jobs?
-craig

"You can never have too many knives" -- Logan Nine Fingers
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Post by chetan.c »

I need one sequence that can be used across all the jobs.

Thanks,
Chetan.C
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then you can't use a file because of concurrency issues. If you can't use a DB sequence, then look into the Server SDK KeyMgnt routines to generate a Surrogate Key, in particular the 'concurrent' version.
-craig

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