UNLOCK
Release file/record locks set by the current user
Syntax
UNLOCK [ALL]
Arguments
ALL releases all current locks in all work areas. If not specified, only the lock in the current work area is released.
Description
UNLOCK is a network command that releases file or record locks set by the current user. Use it when you want to release the current lock without setting a new lock. Both FLOCK() and RLOCK() release the current lock before setting a new one.
After an UNLOCK, an update to a shared database file and associated index and memo files becomes visible to DOS and other applications, but is not guaranteed to appear on disk until you perform a COMMIT or close the file.
Refer to the “Network Programming” chapter in the Programming and Utilities Guide for more information on the principles of locking and update visibility.
Notes
. SET RELATION: UNLOCK does not automatically release a record lock along a RELATION chain unless you UNLOCK ALL.
Examples
. This example attempts an update operation that requires a record lock. If the RLOCK() is successful, the record is updated with a user-defined function and the RLOCK() is released with UNLOCK: USE Sales INDEX Salesman SHARED NEW IF RLOCK() UpdateRecord() UNLOCK ELSE ? "Record update failed" BREAK ENDIF
Seealso
DBUNLOCK(), DBUNLOCKALL(), FLOCK(), RLOCK(), SET RELATION