Technical data
USE
11. A database USE procedure executes for a COBOL DML statement’s exception
condition: ( a ) if the OTHER phrase is the only phrase specified in the
program, and ( b ) if these conditions are also true:
• The COBOL DML statement has no ON ERROR phrase
• The COBOL DML statement has no AT END phrase
• The program does not specify an ON phrase for that exception condition
After the USE procedure executes, control returns to the next executable
statement in the invoking routine, if one is defined. Otherwise, control
transfers according to the rules for Explicit and Implicit Transfers of Control.
12. If the ON DBM$_exception-condition phrase is specified and a COBOL DML
statement results in a database exception condition, execution continues as
follows:
• If the value of DB-CONDITION is equal to a DBM$_exception-condition,
the procedures associated with that DBM$_exception-condition execute.
• If the value of DB-CONDITION is not equal to any DBM$_exception-
condition, the procedures associated with the OTHER phrase execute.
13. If a database exception condition occurs and there is no applicable USE FOR
DB-EXCEPTION procedure, uncommitted transactions roll back and the
image terminates abnormally.
Additional Reference
• Section 4.3, Scope of Names
Example
(The Technical Notes following this example explain execution of the USE
procedures shown.)
PROCEDURE DIVISION.
DECLARATIVES.
200-DATABASE-EXCEPTIONS SECTION.
USE FOR DB-EXCEPTION ON OTHER.
201-PROCEDURE.
DISPLAY "DATABASE EXCEPTION CONDITION".
PERFORM 250-DISPLAY-MNEMONIC.
210-DATABASE-EXCEPTIONS SECTION.
USE FOR DB-EXCEPTION ON DBM$_NOTIP.
211-PROCEDURE.
DISPLAY "DATABASE EXCEPTION CONDITION ON READY STATEMENT"
PERFORM 250-DISPLAY-MNEMONIC.
250-DISPLAY-MNEMONIC.
*
* DBM$SIGNAL displays a diagnostic message based on the
* status code in DB-CONDITION.
*
*
CALL "DBM$SIGNAL".
STOP RUN.
END DECLARATIVES.
4–64 Procedure Division