generation of surroagte key

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
bunny
Participant
Posts: 10
Joined: Thu Apr 21, 2005 8:06 am
Contact:

generation of surroagte key

Post by bunny »

hi all;

i have 26,000 input records.


based on number of records, i need to genearte surroagte key sequence.

. i am using keymgtgetnextvalue(%sequence name%),


in sequence name i am giving input column totalnet assets which is unique for each row if it exists,

when i run the same job first time it's starting id =1,

when i run the jsame ob for second time it's starting id =2

when i run the jsame ob for third time its' id =3


what might be the problem?

thanks in advance.
kris
Participant
Posts: 160
Joined: Tue Dec 09, 2003 2:45 pm
Location: virginia, usa

Re: generation of surroagte key

Post by kris »

bunny wrote:. i am using keymgtgetnextvalue(%sequence name%),


in sequence name i am giving input column totalnet assets which is unique for each row if it exists,
You should give a name which is unique for the whole project but not input column which is changing for each record.

Give a name in single quotes something like 'Accounts'

your derivation should look like

Code: Select all

keymgtgetnextvalue('Accounts')
It will generate unique numbers for each record. and when you run next time it will give you the next unique number.

And this seed 'Accounts' is your project dependent. Whenever you feed this to your keymanagement routine you will get a new number.

Kris~
harithay
Participant
Posts: 106
Joined: Tue Dec 14, 2004 10:51 pm

Post by harithay »

Thank you kris,
asoka_dwh
Participant
Posts: 11
Joined: Mon Oct 24, 2005 11:37 pm
Contact:

Re: generation of surroagte key

Post by asoka_dwh »

kris wrote:
bunny wrote:. i am using keymgtgetnextvalue(%sequence name%),


in sequence name i am giving input column totalnet assets which is unique for each row if it exists,
You should give a name which is unique for the whole project but not input column which is changing for each record.

Give a name in single quotes something like 'Accounts'

your derivation should look like

Code: Select all

keymgtgetnextvalue('Accounts')
It will generate unique numbers for each record. and when you run next time it will give you the next unique number.

And this seed 'Accounts' is your project dependent. Whenever you feed this to your keymanagement routine you will get a new number.

Kris~

" whats is the actual syntax for reseting current 'sequence' "

any answers for this regard
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Many answers. A search on 'sdksequences' will turn up much discussion on the subject. As to a code sample:

Code: Select all

UPDATE SDKSequences USING DICT VOC SET F1 = 'YourDesiredValue' WHERE @ID = 'YourSequenceName';
Obviously, you'll need to make a couple of substitutions. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
jreddy
Premium Member
Premium Member
Posts: 202
Joined: Tue Feb 03, 2004 5:09 pm

Post by jreddy »

I tried this, but am getting the error message

DataStage/SQL: Table SDKSequences does not exist

What does this mean.. ? I have done these update many times before.. but on this new server i am getting this error.. any ideas on how to make this work.. thanks in advance
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It means that you've never successfully invoked either of the key management functions in that project. If you had, then the hashed file SDKSequences would have been created.
You can create it yourself if you wish, using the following command from the Administrator client's Command window.

Code: Select all

CREATE.FILE SDKSequences 2 1 1 
Note that the file name is case sensitive.
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