Technical data
FETCH
FETCH
Function
The FETCH statement is a combined FIND and GET that establishes a specific
record in the database as the current record of the run unit and makes the record
available to the run unit in the user work area.
General Format
FETCH
database-record
FOR UPDATE
RETAINING
REALM
RECORD
SET [ set-name ] . . .
{ set-name } . . .
CURRENCY
AT END stment
NOT AT END stment2
ON ERROR stment NOT ON ERROR stment2
END-FETCH
database-record
represents a record selection expression. References are made to a record in the
database according to the rules for Record Selection Expressions (see Section 4.6).
set-name
names a subschema set type.
stment
is an imperative statement executed for an AT END or ON ERROR condition.
stment2
is an imperative statement executed for a NOT AT END or NOT ON ERROR
condition.
General Rules
1. database-record must reference a record stored in a realm that is in ready
mode.
2. The FETCH statement is equivalent to the following sequence of statements:
FIND database-record . . .
GET . . .
3. Execution of the FETCH statement causes database-record to become the
current record of the run unit.
4. The FOR UPDATE option puts a no-read lock on the specified record.
Procedure Division 4–31