key management

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
jlegare
Participant
Posts: 6
Joined: Tue Jan 06, 2004 2:33 pm

key management

Post by jlegare »

Want to use the KeyMgtGetNextValue(%SequenceName%) DS Transform

Have the following questions.

How can I determine what the next value assigned will be?

How can I reset values?

Where is the sequence stored?

At what level must SequenceName be unique: job, project, instance?

Thank You

J.
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Re: key management

Post by raju_chvr »

jlegare wrote: How can I determine what the next value assigned will be?

It will start from 1 and go on.
jlegare wrote: How can I reset values?

use the following in your before-job subroutine

UPDATE SDKSequences USING DICT VOC SET F1 = '1' WHERE @ID = 'yournumber';
jlegare wrote: Where is the sequence stored?

Stored in DS Universe Hash file
jlegare wrote:
At what level must SequenceName be unique: job, project, instance?
I belive they shld be unique at project level.

IHTH
jlegare
Participant
Posts: 6
Joined: Tue Jan 06, 2004 2:33 pm

clarification

Post by jlegare »

Thanks for the info.

If the sequence has already been used how would I tell what the next number would be - or in otherwords the last issued number.


for reset the recommended syntax was:

UPDATE SDKSequences USING DICT VOC SET F1 = '1' WHERE @ID = 'yournumber';


Woudl this update all sequences?

Where do I specify the name of a specific sequence.?

What is yournumber?

Thanks

?J.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

SDKSequences should have @ID set to the table name. So no it will not reset them all. Remove the WHERE clause and it will.
Mamu Kim
nsm
Premium Member
Premium Member
Posts: 139
Joined: Mon Feb 09, 2004 8:58 am

Post by nsm »

Hi,

I have a keymanagment routine and i am using the same routine for different jobs with different sequence names.

for ex:

keymgmt("emp_key").
keymgmt("dept_key")

if i wanted to reset the dept_key to a particular value, without resetting emp_key what should i do?

even i wanted to find out how it stores those sequences internally, if i am using same sequence for different jobs.

truely speaking i didn't really understand what has discussed on this.


nsm.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

SDKSequences is a table.
It's key value is the argument for KeyMgtGetNextValue.
It has one other column; the next value to be used in the sequence.

Therefore, to reset just one "sequence", use a WHERE clause in the UPDATE statement.

Code: Select all

UPDATE SDKSequences USING DICT VOC SET F1 = '1' WHERE @ID = 'dept_key'; 
You can execute this from anywhere you can execute "UniVerse" commands, including:
  • Administrator client Command window
    telnet connection into project
    before/after subroutine using ExecTCL
    calling DSExecute subroutine with "UV" as the Shell argument
    using EXECUTE or PERFORM statement in DataStage BASIC code
Don't forget to verify that the operation succeeded. 8)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
phanee_k
Charter Member
Charter Member
Posts: 68
Joined: Thu Nov 20, 2003 11:02 pm

Not resetting

Post by phanee_k »

Hi,
I have routine ErrID(0) with 0 as argument.
The command that is mentioned is not resetting the value.
The value is getting incremented.

I gave the command mentioned in Before/after stage routine
using ExecTCL and inputvalue

UPDATE SDKSequences USING DICT VOC SET F1 = '1' WHERE @ID = '0';

Please let me know what went wrong in this.

regards
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

The surrogate key hash file contains a localized set of values to use for assignments. You need to keep these values in sync with the actual target table. Imagine if you manually loaded more rows into the target table, now your hash file has no awareness of the current maximum value assigned in the table.

You should write a simple job that selects the maximum surrogate key value on the target table. You then spool the output to the hash file used by your assignment routine. Anytime you want this value reset to the currently assigned max, just run the job. In fact, it probably would be a really good practice to put that job into your jobstream as the first job that runs. If you have multiple target tables getting surrogates, just write one job with a bunch of select max queries sending their output to the same hash file. Another trick is a single OCI/ODBC stage with a bunch of select max queries unioned to stream all of your values to the hash file in one operation.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

We will need to see the code of ErrID routine before being able to diagnose.
Did you capture the output of the SQL statement so that you could check for errors? If so, what message was output?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply