FILELOCK

FILELOCK


file.variable Index Level FILEUNLOCK
Syntax FILELOCK {file.variable} {LOCKED statement.block}
Category BASIC
Type Statement
Description sets an exclusive lock on an entire file.

Once a file lock has been set, any other port which attempts to update, item lock, or file lock that file will fail.

If file.variable is not specified, then the default file variable is assumed.

The filelock is useful preventing updates to a file while a sequential operation is running (like a BASIC select).

If the file is already locked (meaning another user has a file or an item lock, or is currently updating that file) and the optional locked clause is present, then statement.block is executed.  If no locked clause is present, then the statement blocks until the situation is resolved.

File locks are displayed by the "list-locks" TCL command as special item locks with item id's of "*" and hash's of 0.  If necessary, these locks can be cleared abnormally with the "unlock-file" command.
Options
See Also statements & functions FILEUNLOCK list-locks BEGIN WORK
Example
Warnings The filelock statement sets a very broad lock which may severely impact other users. Developers should plan carefully when using this facility.
Compatibility D3 7.0
file.variable Index Level FILEUNLOCK