HP 3000 Manuals

ON DBERROR [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

ON DBERROR 

The ON DBERROR statement defines a database error-handling routine.  The
ON DBERROR statement is unnecessary if each database operation utilizes
the STATUS option because the status array returns the error code, and
the error does not stop the program.

The ON DBERROR statement is disabled by the OFF DBERROR statement.

Syntax 

            {GOTO  }
           {{GO TO }        }
ON DBERROR {{GOSUB } line_id}
           {{GO SUB}        }
           {CALL sub_id     }

Parameters 

line_id          Line label or line number.

sub_id           Subunit identifier.

Table 4-7 shows the similarities and differences between the three forms
of the ON DBERROR statement.

          Table 4-7.  ON DBERROR Statements 

----------------------------------------------------------------------------------------------
|                                    |                           |                           |
|       Statement Executed If        |       Line to Which       |    Scope of ON DBERROR    |
|       Run-Time Error Occurs        |    Error-Handling Code    |         Statement         |
|          After ON DBERROR          |  Transfers Control When   |                           |
|         Statement Executes         |          it Ends          |                           |
|                                    |                           |                           |
----------------------------------------------------------------------------------------------
|                                    |                           |                           |
| GOTO line_id                       | None.                     | Program unit that         |
|                                    |                           | contains it.              |
|                                    |                           |                           |
----------------------------------------------------------------------------------------------
|                                    |                           |                           |
| GOSUB line_id                      | Line following the line   | Program unit that         |
|                                    | where the error occurred. | contains it.              |
|                                    |                           |                           |
----------------------------------------------------------------------------------------------
|                                    |                           |                           |
| CALL sub_id                        | Line following the line   | Program unit that         |
|                                    | where the error occurred. | contains it and program   |
|                                    |                           | unit that this program    |
|                                    |                           | unit calls (until called  |
|                                    |                           | program unit executes a   |
|                                    |                           | local ON DBERROR          |
|                                    |                           | statement or an OFF       |
|                                    |                           | DBERROR statement).       |
|                                    |                           |                           |
----------------------------------------------------------------------------------------------

Examples 

     100 ON DBERROR GOTO 500    !Goes to line 500
     110 ON DBERROR GOTO Rtn5   !Goes to the line number in Rtn5
     120 ON DBERROR GOSUB 650   !Goes to the subroutine at line 650
     130 ON DBERROR GOSUB Rtn7  !Goes to the subroutine at the line in Rtn7
     140 ON DBERROR CALL Error  !Goes to the Error subroutine



MPE/iX 5.0 Documentation