Technical data

6
DML Programming—Tips and Techniques
We’ve gathered some tips and techniques you can use to improve program
performance and reduce development and debugging time. These include special
use of modes, indicators, conditions and statements, as well as debugging
techniques.
6.1 The Ready Modes
Proper use of the READY usage modes can improve system performance.
You inform the DBCS of your record-locking requirements when you issue the
READY command. The command takes the form:
READY <allow-mode> <access-mode>
or
READY <access-mode> <allow-mode>
The allow- and the access-mode arguments pass your requirements to the DBCS.
The allow-mode object of the READY command indicates what you will allow
other run units to do while your run unit works with storage areas within the
realm you readied. There are four different allow modes as follows:
CONCURRENT Permits other run units to ready the same realm or realms that
contain the same storage areas as the realms your run unit readied.
CONCURRENT also allows other run units to perform any DML function
on those storage areas, including updates.
PROTECTED Permits other run units to use the same storage areas as your run unit,
but does not allow those run units to update records in the storage areas.
EXCLUSIVE Prohibits other run units from even reading records from the restricted
storage areas.
BATCH Allows concurrent run units to update the realm. BATCH also allows you
to access or update any data in the realm while preventing concurrent
run units from accessing or updating the realm.
While the allow mode says what your run unit will allow other run units to
do, the access mode says that your run unit will either read or write records
(RETRIEVAL or UPDATE).
Because the UPDATE access mode can lock out other users, use it only for
applications that perform database updates. If an application accesses the
database for inquiries only, use the RETRIEVAL access mode. The RETRIEVAL
mode also prevents a run unit from accidentally updating the database.
The combination of the allow mode and the access mode is called the usage mode.
There are eight READY usage modes as follows:
CONCURRENT RETRIEVAL
CONCURRENT UPDATE
DML Programming—Tips and Techniques 6–1