TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)

Chapter 4 97
Using the Database
Opening the Database
Here is a summary of the acceptable environments:
Multiple access mode 1 and access mode 5 users
Multiple access mode 6 and access mode 2 users
Multiple access mode 6 users and one access mode 4 user
Multiple access mode 6 and access mode 8 users
One access mode 3 user
One access mode 7 user
Subsets of these environments are also allowed. For example, all users can be access mode
5, 6, or 8 users; or there could be one access mode 1 user; and so on.
If an access mode 3 or 7 user is currently accessing the database, it cannot be opened until
that user closes the database. This is true any time an attempt is made to open a database
in an access mode that is not compatible with the access modes of others using the
database.
Database Operations
This section explains in detail what occurs when a database is opened in a particular
mode. Locking is available in all modes. In the discussion that follows, brief suggestions
are given as to when locking can be used. Refer to the discussion of the locking facility
later in this chapter for more information.
Access Mode 1. The database is opened for shared modify access. Opening in mode 1
succeeds only if all other current users of the database are using access modes 1 or 5.
All TurboIMAGE/XL procedures are available in this mode. The critical item update
(CIUPDATE) option, which can permit you to update the values of detail data set search
and sort items, is available in this mode. A program must obtain temporary exclusive
control of the data entries before calling any procedure that changes them, such as,
DBUPDATE, DBPUT, or DBDELETE. In this way, changes to the database are synchronized
and carried out properly. This exclusive control must subsequently be relinquished to
permit other access mode 1 or mode 5 users to access these entries. Acquiring and
relinquishing is referred to as locking and unlocking, respectively. These functions are
supplied by the TurboIMAGE/XL library procedures, DBLOCK and DBUNLOCK. The
locking requirements can be met by locking the affected entries, the sets containing the
entries, or the whole database.
A mode 1 (and mode 5) user who has all or part of the database locked is assured that
no concurrent user is modifying that part of the database.
It is possible to read entries in the database using calls to DBFIND and DBGET without
locking, but the calling program must provide for the possibility that another process
could be simultaneously modifying the database. This can result in an entry being
deleted from a chain which the calling program is reading.
Access Mode 2. The database is opened for shared update access. The DBOPEN call
succeeds only if all current users of the database are using access modes 2 and 6. All
TurboIMAGE/XL procedures are available to the access mode 2 user except DBPUT and
DBDELETE which are disallowed in this mode. The critical item update (CIUPDATE)