Lock and Unlock statements (LotusScript® Language)

Provide controlled access to files.

Syntax

Lock [#]fileNumber [ , recordNumber | {[ start ] To end } ]

Unlock [#]fileNumber [ , recordNumber | { [ start ] To end } ]

Elements

fileNumber

The number assigned to the file when you opened it.

recordNumber

In a random file, the number of the record that you want to lock or unlock. In a binary file, the byte that you want to lock or unlock. The first record in a random file is record number 1; the first byte in a binary file is byte number 1. LotusScript® locks or unlocks only the specified record or byte.

In a sequential file, LotusScript® locks or unlocks the whole file, regardless of value you specify for recordNumber.

start To end

In a random file, the range of record numbers you want to lock or unlock. In a binary file, the range of bytes that you want to lock or unlock. If you omit start, LotusScript® locks records or bytes from the beginning of the file to the specified end position. In a sequential file, LotusScript® locks or unlocks the whole file, regardless of the start and end values.

Usage

In Windows 3.1, you must run SHARE.EXE to enable the locking feature if you are using MS-DOS version 3.1 or later. Earlier versions of MS-DOS do not support Lock and Unlock.

Always use Lock and Unlock statements in pairs whose elements-- fileNumber, recordNumber, start, and end -- match exactly. If you do not remove all locks, or if the elements do not match exactly, unpredictable results can occur.

Example