Using EXCLUSIVE-LOCKs
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
Your first test involves using EXCLUSIVE-LOCKs.
To test locking conflicts when using an EXCUSIVE-LOCK:
- From your first session, create a new procedure window by selecting the menu item.
- Enter this code to retrieve the first Customer record
with an exclusive lock:

- From the Desktop in your second session, bring up the Procedure Editor.
- In the Procedure Editor in your second session, enter the same
procedure, but with a message that says User 2 instead of User 1:

- Run the first procedure. The window for the first session comes
up:

- Run the procedure in the second session. Because it's trying
to get an exclusive lock on a record already locked by the other
process, you get a message telling you that the record is in use
and that you must either wait or cancel out of the
FINDstatement:
If you close the first window, the second process can now read and lock the Customer record:
This example illustrates the most basic rule of record locking.
Only one user can have an EXCLUSIVE-LOCK on a record
at a time. Any other user trying to lock the same record must either
wait for it or cancel the request.