A Typical Multi-user Environment [ Micro Focus COBOL for UNIX COBOL User Guide ] MPE/iX 5.0 Documentation
Micro Focus COBOL for UNIX COBOL User Guide
A Typical Multi-user Environment
In your program you can lock a single record, a group of records, or a
whole file. When data is locked by one user, no other user can delete or
change that data. Details on how to lock data are given in the section
Multi-user Syntax.
If the user locks the whole file (called an exclusive lock), no other
user can access that file. If the user locks records (either single
record locks or multiple record locks), the file is sharable with other
users. Other users might also lock records in the same file. Each user
can lock a single record or multiple records. Any user can access any
data that is not locked by another user.
The user can open several data files at the same time, and can specify
locking for each data file that is opened. However, the user is allowed
only one type of locking for each file - that is, locking of the whole
file, locking of a single record or locking of multiple records.
Default locking
When you do not explicitly specify locking in your program, files opened
I-O, OUTPUT or EXTEND acquire an exclusive lock by default. That is, the
whole file is locked by your program. If, however, your program opens
the file for INPUT, the file becomes sharable (read-only), and your
program cannot hold record locks on the file. Other users can also open
the same file for INPUT without specifying any locking syntax. This
default locking is used for each file that your program opens when no
LOCK MODE syntax is included in your program.
In a multi-user environment each user can open more than one file, and
each user can have access to the same data files as other users. A file
that is sharable can be accessed by one or more programs, each locking
one record in the file or multiple records in the file. Figure 6-1
shows a typical moment in the use of a multi-user environment.
Figure 6-1. A Typical Multi-user Environment
MPE/iX 5.0 Documentation