LOCK Verb - Lock File

Syntax

LOCK (channelno{,ERR=lineref})

Description

For BBj-specific information, see the LOCK Verb - Lock File BBj.

The LOCK verb locks the file opened on channelno for exclusive access by the current user. An error is issued if the file is already OPENed on any other channel or by any other user. In addition, an error occurs when trying to lock a file that has already been locked using any channel. The file may be unlocked by closing channelno or by the UNLOCK statement. LOCKing a device may not be legal on some systems.

PRO/5 requires serial files to be LOCKed before writing to them.

NOTE: LOCK locks an entire file, while EXTRACT locks individual records. If the operating system does not allow the same process to own overlapping locks, a developer cannot LOCK a file while a record is already locked with EXTRACT. Many versions of UNIX allow overlapping locks but Windows does not.

Example

>LOCK (1)
1000 LOCK(X,ERR=9500)

See Also

Verbs - Alphabetical Listing