UNLOCK Command

Example   See Also

Releases a record lock, multiple record locks, or a file lock from a table, or releases all record and file locks from all open tables.

Syntax

UNLOCK
  [RECORD nRecordNumber]
  [IN nWorkArea | cTableAlias]
  [ALL]

Arguments

RECORD nRecordNumber

Releases the record lock on record number nRecordNumber. You can specify 0 for nRecordNumber to unlock a table header locked with LOCK(0) or RLOCK(0).

Issuing UNLOCK RECORD nRecordNumber for a record in a table with a file lock releases the file lock.

IN nWorkArea | cTableAlias

Releases a record lock (or locks) or a file lock from a table in a specific work area. nWorkArea specifies a work area number and cTableAlias specifies a table alias. If you don't include nWorkArea or cTableAlias, UNLOCK releases a record lock (or locks) or a file lock from the table in the currently selected work area.

ALL

Releases all record and file locks in all work areas.

For more information about record and file locking and sharing tables on a network, see Chapter 17, Programming for Shared Access, in the Programmer's Guide.

Remarks

Record and file locks can be removed from a table only by the user who issued the locks. UNLOCK cannot unlock a table opened for exclusive use.

A record lock (or locks) or a file lock is released from the table in the current work area if you issue UNLOCK without any additional arguments.

If relations are established between tables, releasing a record lock (or locks) or a file lock from one of the tables doesn't release locks from the related records or files. You must explicitly release the record or file locks in each of the related files. You can release all locks on any related tables by issuing UNLOCK ALL (this also releases locks in unrelated files).