KeyMgtGetNextValueConcurrent

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
sri75
Premium Member
Premium Member
Posts: 132
Joined: Thu Sep 09, 2004 12:42 pm

KeyMgtGetNextValueConcurrent

Post by sri75 »

Hi,


We are testing peoplesoft delivered job.In one of them there is a function KeyMgtGetNextValueConcurrent to generate sequence number.

when I ran the job, it created seq numbers from 1 to 10.now I want to reset this number back to 1

I gave this query in adminstrator

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

it is not updating any records, saying 0 records updated

in one of 2 stage variables

NextValue -If @INROWNUM = 1 Then "w" Else (NextValue)

nextSeq -IF link1.NOTFOUND THEN keyMgtGetNextValueConcurrent(NextValue) Else link2.SRC_SID
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The value you give to @ID in your UPDATE statement must be the same string (the name of the sequence) that you give in the KeyMgtGetNextValueConcurrent() function. Display the contents of SDKSequences to see what I mean.

Code: Select all

SELECT @ID FMT '32L', F1 FMT '10R' FROM SDKSequences USING DICT VOC;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sri75
Premium Member
Premium Member
Posts: 132
Joined: Thu Sep 09, 2004 12:42 pm

Post by sri75 »

Thanks Ray for the query

It explains me well.Now I am able to update the sequence.
I have one more question


SELECT @ID FMT '32L', F1 FMT '10R' FROM SDKSequences USING DICT VOC;

VOC ------------------------------------------------F1 ------------

HCM 3
EPM 12

numbers under F1 field are no of records, right ?
can we open the sequence and see the records to get the max seq no.I think here it shows only number of records in the sequence.

like this
select * from SDKSequences where @ID = 'EPM';

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

Post by ray.wurlod »

Not quite right. What's in field F1 is the next available key value. It's ordinarily one more than the number of records, provided that this is the only method used for maintaing the keys.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
maheshsada
Participant
Posts: 69
Joined: Tue Jan 18, 2005 12:15 am

Post by maheshsada »

you can open the sequence file, this file is a hashed file and will be available under projects/<your project name>, the name of file is SDKSequences.

To access the file create a job and use a hashed stage, create two columns with varchar(10), check the first column as key, then write the detail to sequence file, where u can update the particular sequence name(name which is used in keymgt function) to specified value. Then create a job to re-create the hashfile.

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

Post by ray.wurlod »

And what happens to all the other sequences in SDKSequences if you arbitrarily re-create the hashed file?!!!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
maheshsada
Participant
Posts: 69
Joined: Tue Jan 18, 2005 12:15 am

Post by maheshsada »

The other sequences within the project will not be affected by recreating the hashfile.

suppose there are two sequence in a project Seq1 and Seq2, and if we change Seq1 and recreate the hashfile, Seq2 will also be created without the changed values(since we are not deleting the Seq2 from the file for creating hashfile) and has worked fine

Magesh S
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

We're obviously stumbling over the meaning of the word 'recreate'. :?

It means to delete and then create again. This implies the new file would be empty which is why Ray made his comment and which would definitely effect every other sequence that was (formerly) held by that static hashed file.

I suspect maheshsada actually means 'update'. Or you need to be more careful in your advice and be more clear on the process you are suggesting, otherwise you could cause someone to do themselves some damage.

This is certainly the long way to accomplish this, but it sounds like you suggesting two jobs. One to dump the contents of the SDKSequences to a flat file where one would edit the value(s) in question. And then a second job to recreate the hashed file and then reload it from the flat file. Yes, that would certainly work.

Best to just issue the UPDATE sql. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

affect
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:roll: Sorrie.
-craig

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