Here is an excerpt:
Code: Select all
* Read the named record from the file.
* This obtains the lock (waiting if necessary).
Readu NextVal From SeqFile, Arg1 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
Code: Select all
UtilityHashLookup("SDKSequences", %Key%, "")
The problem is, the Ans returned from the routine does not equal the value stored in the hashed file.
This issue could be fixed with this code (untested):
Code: Select all
* Read the named record from the file.
* This obtains the lock (waiting if necessary).
Readu NextVal From SeqFile, Arg1 Else
NextVal = 0
End
NextVal = NextVal + 1
Ans = NextVal
* Increment the sequence value, and write back to file.
* This releases the lock.
Write NextVal On SeqFile, Arg1 Else Ans = -1
Code: Select all
UtilityHashLookup("SDKSequences", %Key%, "")-1
Anyway, I thought I'd point this out so you don't waste the time I did wondering why your FK's were out of sync with your SK's.