dclock, dclockw, dcunlock - lock/unlock current data record for
exclusive use



int dclock (fcb)
DFILE *fcb;

int dclockw (fcb)
DFILE *fcb;

int dcunlock (fcb)
DFILE *fcb;


Dclock attempts to lock the current data record for exclusive use
and returns immediately with a status code. If the current record
was locked successfully, dclock returns a positive value. If the
record could not be locked, perhaps because it was already locked
by another process, a zero value is returned.

Dclockw attempts to lock the current data record for exclusive
use and waits until the record can be locked before returning.
Dclockw normally returns a positive value.

Dcunlock unlocks a record that was locked with dclock or dclockw.

Fcb is the file block pointer returned by dlopen(C-3) or

These routines must be used with the RMS file functions that
update records in a multi-user environment. The RMS file
functions do not automatically lock files or records to prevent
simultaneous access to data by multiple processes.

These routines lock only one record at a time. It is permissible
to lock more than one record in the same RMSfile or to lock
records in more than one RMSfile. Note that locking more than one
record at a time may create a deadlock in which case the locking
is denied.


dflock(C-3), drlock(C-3), dilock(C-3), dlopen(C-3), dopen(C-3),
Chapter 4, RMS Programming Guide


Dclock and Dclockw return a value of zero (0) if fcb is not an
opened file block pointer or if locking the current record would
cause a deadlock.


Dcunlock cannot be used after a record is deleted since there is
no current record after a delete is performed. In this case, call