i know this issue is already discussed in this forum.. but i need some guidence on this..
I have server job which is using KeyMgtGetNextValueConcurrent() routine..
1> as part of upgrade jobs/routines/shared contianers.. moved from 7.5.2 to 8.5 and re-compiled.
2> all tables were moved to new DB server.
Issue : now when i ran the job which is having KeyMgtGetNextValueConcurrent() is generating the number which is already existing in the table and row is getting dropped.
So if i want my job to use max value of the table ... how to proceed.
Routine:
Code: Select all
EQUATE RoutineName TO 'KeyMgtGetNextValueConcurrent'
If NOT(Initialized) Then
* Not initialised. Attempt to open the file.
Open "SDKSequences" TO SeqFile Else
* Open failed. Create the sequence file.
EXECUTE "CREATE.FILE SDKSequences DYNAMIC"
Open "SDKSequences" TO SeqFile Else
Ans = -1
Goto EndRtn
End
End
Initialized = 1
KeyName = ""
NextVal = ""
End
* Read the named record from the file.
* This obtains the lock (waiting if necessary).
Readu StartVal From SeqFile, Arg1 Else
StartVal = 1
End
Locate Arg1 In KeyName By 'AL' Setting Idx Else
Ins Arg1 Before KeyName<Idx>
Ins StartVal Before NextVal<Idx>
End
Ans = StartVal
* Increment the sequence value, and write back to file.
* This releases the lock.
NextVal<Idx> = StartVal + 1
Write NextVal<Idx> On SeqFile, Arg1 Else Ans = -1
EndRtn:
Code: Select all
UPDATE SDKSequences USING DICT VOC SET F1 = '1' WHERE @ID = 'Your_Sequence_Name';
i.e IBM\InformationServer\Server\DSEngine.. or any other location..
thanks in advance