Lockwait
lockwait
is an Integer system variable of the Integer type. It allows you to set the maximum of seconds that each lock attempt will last using the Lock and Readlock instructions.
After a first failed lock attempt, the system will retry every second for the duration defined by the lockwait
value.
lockwaitLock ... with lockwait=...Readlock ... with lockwait=...
If the value of lockwait
is negative, the attempt time will be unlimited. If its value is null, a single attempt will be made.
The Lock or Readlock syntax With lockwait =...
allows you to assign this variable only for the instruction considered.
lockwait
is not taken into account by For... With Lock
syntax, nor by the Update instruction. A single attempt will be made for these instructions.
# Update a counter value with a five seconds waiting time when conflict occursTrbeginRaz BADLOCKLock COUNTER With lockwait = 5If fstatBADLOCK = 1RollbackElse[C]COUNTER += 1CommitEndif# Set the lockwait value to 0 (return immediately an error in case of locking issue)lockwait=0Readlock [MYT]KEY=MYKEYIf fstat=1# The record has already been locked...Endif