HP 3000 Manuals

File Sharing [ Micro Focus COBOL for UNIX COBOL User Guide ] MPE/iX 5.0 Documentation


Micro Focus COBOL for UNIX COBOL User Guide

File Sharing 

Your system supports a multi-user environment in which several users can
share the same files.  While a program is updating data records in a file
it can deny other users access to those records or to the entire file.

In a multi-user environment, your files are either active or inactive.
An active file is open to a program while an inactive file is not.
Furthermore, active files can be in either of two modes:  exclusive and
sharable.

Active Files in Exclusive Mode 

Exclusive mode files are only open to one program at a time.  Any other
program that attempts to access the file receives a "file locked" error
(file status 9/065) and is denied access.  When a file is in exclusive
mode, a file lock is held by the one program that is able to access the
file.  The exclusive mode file lock is released when the program closes
the file.

Active Files in Shareable Mode 

A sharable mode file is available to one or more programs.  A program can
protect data in a record or records while using the file by locking those
records.  Locking records in a file prevents other programs from
accessing those particular records as long as they are locked; it does
not prevent other programs accessing other records in the file.  Each
program accessing the file can lock either a single record or multiple
records.  A program cannot select both single record locking and multiple
record locking for the same file.

To make a file sharable you specify LOCK MODE IS MANUAL or LOCK MODE IS
AUTOMATIC in its SELECT statement.  Even with no such clause the file is
sharable provided users open it in INPUT mode; that is, when you have it
open for reading, other users can open it for reading too but they cannot
update it.  This restriction means the file handler can buffer records,
with no risk of a record being updated after being copied to the buffer.
Buffering gives significantly better performance than would otherwise be
possible.



MPE/iX 5.0 Documentation