Technical data

6.10.2 Releasing Record Locks
Regardless of the READY mode used, you always have a record lock on the
current of run unit. Even the READY CONCURRENT RETRIEVAL mode locks
the current record and puts it in a read-only condition. Furthermore, if you are
traversing the database, the current record for each record type you touch with
a DML statement is locked and placed in a read-only condition. Record locking
prevents other users from updating any records locked by your run unit.
A locked record can prevent accessing of other records. Figure 6–9 shows PART
A locked by run unit A. Assume PART A has been locked by a FETCH statement.
If run unit B is in READY UPDATE mode and tries to: ( 1 ) update PART A,
and ( 2 ) find all of PART A’s member records and their vendor owners, then run
unit B is locked out and placed in a wait state. A wait state occurs when a run
unit cannot continue processing until another run unit completes its database
transaction. Because run unit B uses PART A as an entry point for an update,
the lock on PART A also prevents access to PART As member records and the
vendor owners of these member records.
Figure 6–9 Record Locking
PART A
S−1
S−7
VEND 1 VEND 2
(LOCKED BY RUN−UNIT A)
ZK−1517−GE
If a record is not locked by a STORE or a MODIFY statement, or the database
key for the record is not in a keeplist, you can unlock it by using the FREE
CURRENT statement. By using the FREE CURRENT statement, you reduce
lockout and optimize processing for other run units.
6.11 FIND and FETCH Statements
The FIND and FETCH statements locate a record in the database and make that
record the current record of the run unit. The FETCH statement also copies the
record to the user work area (UWA), thus giving you access to the record’s data.
The FIND does not place a record in the UWA. However, if your only requirement
is to make a record current of run unit, use the more efficient FIND statement.
For example, use the FIND statement if you want to connect, disconnect, or
reconnect without examining a record’s contents.
6.12 FIND ALL Option
The FIND ALL statement puts the database key values of one or more records
into a keeplist. (See the description of FIND ALL in Section 4.9 for syntax
details.)
6–14 DML Programming—Tips and Techniques