How to reset a sequence (running number) generator

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
chinek
Participant
Posts: 75
Joined: Mon Apr 15, 2002 10:09 pm
Location: Australia

Post by chinek »

in oracle db, you can create a sequence ,and from your job connect via odbc to that oracle sequence to get the sequence number.
chinek
Participant
Posts: 75
Joined: Mon Apr 15, 2002 10:09 pm
Location: Australia

Post by chinek »

oops didn't see the next part abt reseting the number. you can drop and recreate the sequence.not tried it but i think you can use OCI to drop sequence in oracle.
cwong
Charter Member
Charter Member
Posts: 26
Joined: Tue Apr 30, 2002 8:02 am
Location: Canada

Post by cwong »

The KeyMgtGetNextValue reads in the next value from a hash file named: SDKSequences under the project directory.
The SDKSequences has 2 columns: Key_Name and Next_value
Key_Name is the key of this hash file.

You can have a separate DataStage job to do the resetting or synchronization of the specific Sequence just before it is used in the next job; or do the "update" in the job control of the job which transformer will use the sequence.

When doing the resetting, you can enter the particular value via a parameter. OR most of the time, you would get the current max value from the database table, i.e. select max(cust_id) from d_customer





cwong
jasper
Participant
Posts: 111
Joined: Mon May 06, 2002 1:25 am
Location: Belgium

Post by jasper »

in DS you can use the variables inrownum and outrownum. I think inrownum is the one you need. This counts for every row in the input and always starts from 1 if the job starts.(migth be a bit tricky if you're rejecting rows from the output).
Hotstuff
Participant
Posts: 1
Joined: Thu Apr 04, 2002 4:41 am
Location: South Africa

Post by Hotstuff »

Hi

Logon using the administrator.
Go to the project that you want to reset the seqno. this is as if you generated a surrogate key.
Type in 'ED SDKSequences "the key name you use in the job"' this must be in the same case as specified in the job.
Press execute
l enter Show the last number
R 1 or the start number you want
press enter
fi
Press enter
this saves the counter

when you run your job it will start at 1

Regards


Hendrik Kuhn
Post Reply