DM IMAGE *MODE Command [ HP ALLBASE/4GL Developer Reference Manual Vol. 2 ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Reference Manual Vol. 2
DM IMAGE *MODE Command
The DM IMAGE *MODE command specifies the access mode used when opening
one or more HP TurboIMAGE/iX databases. The command does not actually
open any data sets.
Formats
{*MODEXCL }
{*MODLOCK }
{*MODREAD }
DM IMAGE *MODE {*READEXCL} :D-database...[; command]
{*READLOCK}
{*READMOD }
{*READSHAR}
{*UPDSHAR }
Parameters
database
The name of the HP TurboIMAGE/iX database(s) for which an access mode is
set. The name must be the HP ALLBASE/4GL name for the database, as
defined in the administrator application.
command
A command to be executed if an error occurs while the DM IMAGE *MODE
command is being executed. You can use any of the following commands:
* ENTER
* EXIT
* EXTERNAL
* MESSAGE
* PROCEED
* SERIES
* TOP
* VISIT
* ZIP
Description
The DM IMAGE *MODE command specifies the access mode that HP ALLBASE/4GL
uses to open the named HP TurboIMAGE/iX database(s) in the current
process.
The default database access mode is *MODE *READLOCK. If no database
access mode has been set for a database, it is opened in the default
mode.
Once the access mode is set for any database, the access will be used
whenever that database is opened. You cannot reset the access mode for a
database while the database is open.
Each mode corresponds to an HP TurboIMAGE/iX access mode. These access
modes are briefly defined in the table below. This table outlines, for
each mode, the equivalent HP TurboIMAGE/iX mode, the modes that can be
used by concurrent users, and the actions that concurrent users may
perform. If a user attempts to access a database in an access mode that
cannot be used with a mode already specified for the database, an error
occurs.
For more information about HP TurboIMAGE/iX access modes, refer to the HP
TurboIMAGE/iX Database Management System Reference Manual.
-------------------------------------------------------------------------------------------------------
| Mode | Mapping to | Read | Modify | Concurrent User | Concurrent |
| | HP Turbo- | | | Modes | Actions |
| | IMAGE/XL Access | | | | |
| | Modes | | | | |
-------------------------------------------------------------------------------------------------------
| *MODLOCK | 1 | Y | Y | * MODLOCK | Modify with locks |
| | | | | and | |
| | | | | *READLOCK | |
| | | | | users | |
-------------------------------------------------------------------------------------------------------
| *UPDSHAR | 2 | Y | Update | *READMOD | Update only |
| | | | only | and | |
| | | | | *UPDSHAR | |
| | | | | users | |
-------------------------------------------------------------------------------------------------------
- *MODEXCL - 3 - Y - Y - None - None -
-------------------------------------------------------------------------------------------------------
| *MODREAD | 4 | Y | Y | *READMOD | Read |
| | | | | users | |
-------------------------------------------------------------------------------------------------------
| *READLOCK | 5 | Y | N | *MODLOCK | Modify with locks |
| | | | | and | |
| | | | | *READLOCK | |
| | | | | users | |
-------------------------------------------------------------------------------------------------------
| *READMOD | 6 | Y | N | *READMOD, | Modify |
| | | | | *READSHAR, | |
| | | | | and | |
| | | | | *UPDSHAR | |
| | | | | users. One | |
| | | | | *MODREAD | |
| | | | | user | |
-------------------------------------------------------------------------------------------------------
- *READEXCL - 7 - Y - N - None - None -
-------------------------------------------------------------------------------------------------------
| *READSHAR | 8 | Y | N | *READMOD | Read |
| | | | | and | |
| | | | | *READSHAR | |
| | | | | users | |
-------------------------------------------------------------------------------------------------------
*MODLOCK. The user who accesses the database in this mode can perform all
database operations, but must lock records before altering them. It is
also wise to lock a record before reading it.
*UPDSHAR. The user is able to read and update existing records in this
mode, but is unable to add or delete records. Concurrent users may also
update or read the database.
*MODEXCL. The database can only be opened in this mode if no other users
are accessing any part of the database. The user can perform all
database operations.
*MODREAD. This is a semi-exclusive mode. A user may access the database
and modify records, and other users may read records (in READMOD mode).
File locking before modifying a record is recommended but not necessary.
*READLOCK. The user who accesses a file in this mode may only read
records. However, concurrent users may lock, and then modify, records.
*READMOD. This is similar to READLOCK mode, but concurrent users need not
lock records before modifying them.
*READEXCL. The database is opened for exclusive read only access. No
other users can access any part of the database.
*READSHAR. The database is opened for users for read access only. The
database values can be guaranteed to be unchanging.
Choosing an Access Mode.
To select an access mode, use the least capability that will accomplish
the task.
If you only need to locate and read or report on information, choose mode
*READLOCK, *READMOD, *READEXCL or *READSHAR.
If you need to update data but not add or delete entries, and no other
parallel processes need to add or delete at the same time, use mode
*UPDSHAR.
To perform all database operations, choose mode *MODLOCK, *MODEXCL, or
*MODREAD.
Using the MODE command with DM IMAGE *MODE.
The DM IMAGE *MODE command works in conjunction with the MODE command to
specify the access restrictions for each HP TurboIMAGE/iX database and
data set. The DM IMAGE *MODE command sets the overall access authority
for the database. The MODE command specifies the access restrictions for
each data set. For example, you can allow write access to the database,
using the DM IMAGE *MODE command, but allow read access only to a
specific data set within the database, using the MODE command.
For each file operation, the DM IMAGE *MODE command and the MODE command
must both be sufficient to do the required tasks. However, the MODE
command must not provide more capability than the DM IMAGE *MODE command.
For example, DM IMAGE *MODE *MODLOCK and MODE *READ can be combined
because reading is a subset of DM IMAGE *MODE *MODLOCK capability, but DM
IMAGE *MODE *READLOCK and MODE *WRITE cannot be used together, because
the MODE command specifies more capability than the DM IMAGE *MODE
command has given to the database. If the MODE command specifies more
capability than the DM IMAGE *MODE command, an error will occur at
run-time if an action is attempted that requires more capability than the
DM IMAGE *MODE command provides.
Example
3 DM IMAGE *MODE *UPDSHAR :D-suppdb
4 MODE *WRITE supplier.
.
6 FILE *NEXT supplier
.
This command sets the database access mode to *UPDSHAR, sets the data set
access mode to *WRITE, and then accesses the supplier data set. The
database is opened in *UPDSHAR mode, and the user is able to update
existing records in the supplier data set.
MPE/iX 5.0 Documentation