HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
4-: 87
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
ON END
The ON END statement traps the end-of-file condition for a specified
file. That is, if an end-of-file is encountered during an I/O operation,
the ON END statement causes an interrupt. When HP Business BASIC/XL
responds to the interrupt, it transfers control to the line, subroutine,
or subprogram specified by the ON END statement.
The OFF END statement disables the ON END statement. If an end-of-file
is encountered during an I/O operation, and no ON END statement is
associated with it (or its ON END statement is disabled), an error
occurs. An active ON ERROR statement can trap this error. See the ON
ERROR statement for more information.
Syntax
{GOTO }
{{GO TO } }
ON END
#fnum
{{GOSUB }
line_id
}
{{GO SUB} }
{CALL
sub_id
}
Parameters
fnum
The file number of the file that the ON END statement
applies to.
line_id
Line label or line number. Control will transfer to
this
line_id
when the ON END statement executes.