open-insight/LSL2/STPROC/RECORD_LOCK.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

30 lines
537 B
Plaintext

compile subroutine record_lock( TableVar, TableName, Row )
$insert logical
declare subroutine msg
declare function send_info
Tries = 0
Locked = false$
LOOP
LOCK TableVar, Row THEN
Locked = true$
END ELSE
Tries += 1
END
UNTIL Locked OR Tries >= 500
REPEAT
IF NOT(Locked) THEN
IF STATUS() THEN
ErrMsg = "Record ":Row:" in File ":TableName:" is locked by your station"
END ELSE
ErrMsg = "Record ":Row:" in File ":TableName:" is locked by another station"
END
MSG(ErrMsg)
END
RETURN