Technical data
12. Integer-exp can be either an integer or an arithmetic expression. Both result
in a longword integer value.
13. Using the FIRST clause is equivalent to OFFSET plus 1. It references the
first database key value in the keeplist.
14. Using the LAST clause is equivalent to OFFSET minus 1. It references the
last database key value in the keeplist.
15. The value of integer-exp points to an entry in keeplist-name. The entry whose
ordinal position in the keeplist is equal to the value of integer-exp is called the
referenced keeplist entry.
a. If integer-exp is positive, the ordinal position is relative to the first entry
in the keeplist.
b. If integer-exp is negative, the ordinal position is relative to the last entry
in the keeplist.
16. An exception condition occurs if:
a. Integer-exp is zero. DB-CONDITION is set to DBM$_BADZERO.
b. The absolute value of integer-exp is greater than the number of database
key values in the keeplist. DB-CONDITION is set to DBM$_END.
c. The identified keeplist is empty. DB-CONDITION is set to DBM$_END.
See the USE statement for information on the USE FOR DB-EXCEPTION
statement.
4.5 Database Conditions
Database conditions allow alternate paths of control depending on the truth value
of a test involving conditions specific to the database environment. The database
conditions are the tenancy, member, and database key conditions.
Database exception conditions can occur during evaluation of these conditions.
If a database exception condition occurs during the execution of a database
condition, the Database Control System (DBCS) places a database exception
condition code in the special register DB-CONDITION. This code identifies the
condition. The DBCS also does the following:
1. Places the record name of database-record in the special register DB-
CURRENT-RECORD-NAME.
2. Places the UID (User ID number) of the database record in DB-CURRENT-
RECORD-ID.
3. Invokes an applicable USE FOR DB-EXCEPTION Declaratives procedure, if
any; otherwise, the DBCS abnormally terminates the run unit (see the USE
statement). Under these circumstances, the result of the test is false.
4–6 Procedure Division