Try OpenEdge Now
skip to main content
ABL Essentials
Handling Data and Locking Records : Record locking in ABL : Record locking examples : Using EXCLUSIVE-LOCKs
Your first test involves using EXCLUSIVE-LOCKs. To test locking conflicts when using an EXCUSIVE-LOCK:
1. From your first session, create a new procedure window by selecting the File > New menu item.
2. Enter this code to retrieve the first Customer record with an exclusive lock:
3. From the Desktop in your second session, bring up the Procedure Editor.
4. In the Procedure Editor in your second session, enter the same procedure, but with a message that says User 2 instead of User 1:
5. Run the first procedure. The window for the first session comes up:
6. 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 FIND statement:
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.