Hello ,
I am using the function KeyMgmtConcurrentNExtValue to derive a primary key.....it was wokring fine and now it has set it self to -1 and my job is hanging up.....what is the reason for this and how do i find out what the current value is
Key Management Concurrent Value - is not working correctly
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
What was the most recent prior good value? You may have experienced "arithmetic overflow".
To determine the current "next available key" value for a given sequence execute the following query.
To determine the current "next available key" value for a given sequence execute the following query.
Code: Select all
SELECT NAME, F1 FMT '10R' COL.HDG "Next Value" FROM SDKSequences USING DICT VOC WHERE NAME = '<<Sequence Name>>';
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hi Ray,
I managed to get the correct value...but when I run its still -1..I went through the code for this routine...and it seems when the file cannot be opened it returns -1. Prior to this execution the job aborted as one of the tables were locked......now all that is resolved but the ID which is generated is stuck at -1.
Should I have the administrator restart the datastage server ? will this resolve the problem...?
I managed to get the correct value...but when I run its still -1..I went through the code for this routine...and it seems when the file cannot be opened it returns -1. Prior to this execution the job aborted as one of the tables were locked......now all that is resolved but the ID which is generated is stuck at -1.
Should I have the administrator restart the datastage server ? will this resolve the problem...?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Make a copy of the routine, and add more complete error handling to the Open and ReadU statements.
Use the new routine to diagnose what's happening.
Code: Select all
Common /Sequences/ Initialized, NextVal, SeqFile
EQUATE RoutineName TO 'KeyMgtGetNextValueConcurrent'
If NOT(Initialized) Then
* Not initialised. Attempt to open the file.
Initialized = 1
Open "SDKSequences" TO SeqFile
On Error
Call DSLogFatal("Error (code " : Status() : ") opening SDKSequences file.", RoutineName)
End
Else
* Open failed. Create the sequence file.
EXECUTE "CREATE.FILE SDKSequences 2 1 1"
Open "SDKSequences" TO SeqFile
On Error
Call DSLogFatal("Error (code " : Status() : ") opening SDKSequences file.", RoutineName)
End
Else
Ans = -1
Call DSLogWarn("Unable to open SDKSequences. Code " : Status(), RoutineName)
End
End
* Read the named record from the file.
* This obtains the lock (waiting if necessary).
Readu NextVal From SeqFile, Arg1
On Error
Call DSLogFatal("Error reading sequence " : Quote(Arg1) : ", code = " : Status(), RoutineName)
End
Else
NextVal = 1
End
Ans = NextVal
NextVal = NextVal + 1
* Increment the sequence value, and write back to file.
* This releases the lock.
Write NextVal On SeqFile, Arg1 Else Ans = -1
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.