Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
LOCKING
◄Up► ◄Contents► ◄Index► ◄Back►
─────LOCKING────────────────────────────────────────────────────────────────
Action
Locks direct-access files and records to prevent access by other
users in a network environment.
Syntax
LOCKING [UNIT=]unitspec
[, ERR=errlabel]
[, IOSTAT=iocheck]
[, LOCKMODE=lockmode]
[, REC=rec]
[, RECORDS=recnum])
If UNIT= is omitted, <unitspec> must be the first parameter.
Parameter Description
unitspec An integer expression for the unit to be locked.
The file attached to <unitspec> must be open for
direct access.
errlabel The label of an executable statement in the same
program unit. An I/O error causes transfer of
control to the statement at <errlabel>. If
<errlabel> is omitted, the effect of an I/O error
is determined by the presence or absence of
<iocheck>.
iocheck An integer variable that returns zero if there is
no error, or the error number if an error occurs.
lockmode A character expression with one of the following
values:
Value Description
'NBLCK' Locks the region for reading
and writing. Default.
'LOCK' Locks the region for reading
and writing. Waits for any part of the
region locked by a different process
to become available.
'NBRLCK' Locks the region for reading.
'RLCK' Locks the region for reading. Waits
for any part of the region locked by
a different process to become available.
'UNLCK' Unlocks the specified region.
rec The number of the first record in a group of records
to be locked or unlocked. If omitted, the next
record is locked.
recnum The number of records to be locked. Defaults to one.
Remarks
LOCKING has no effect when used with versions of MS-DOS before
3.0.
If a parameter is an expression that calls a function, that
function must not execute an I/O statement or the EOF intrinsic
function. Calling these functions causes unpredictable results.
-♦-