Page 1 of 1

KeyMgtGetNextValueConcurrent

Posted: Mon May 14, 2007 12:14 pm
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

Posted: Mon May 14, 2007 4:29 pm
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;

Posted: Tue May 15, 2007 8:30 am
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

Posted: Tue May 15, 2007 4:34 pm
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.

Posted: Thu May 17, 2007 5:09 am
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

Posted: Thu May 17, 2007 4:42 pm
by ray.wurlod
And what happens to all the other sequences in SDKSequences if you arbitrarily re-create the hashed file?!!!

Posted: Fri May 18, 2007 2:51 am
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

Posted: Fri May 18, 2007 6:38 am
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:

Posted: Fri May 18, 2007 4:51 pm
by ray.wurlod
affect

Posted: Fri May 18, 2007 5:12 pm
by chulett
:roll: Sorrie.