The ON_IOERROR procedure specifies a statement to be jumped to if an I/O error occurs in the current procedure. Normally, when an I/O error occurs, an error message is printed and program execution is stopped. If ON_IOERROR is called and an I/O related error later occurs in the same procedure activation, control is transferred to the designated statement with the error code stored in the system variable !ERROR_STATE. The text of the error message is contained in !ERROR_STATE.MSG.
The effect of ON_IOERROR can be canceled by using the label "NULL" in the call.
The following code segment reads an integer from the keyboard. If an invalid number is entered, the program re-prompts.
VALID = 1 ; If we get here, i is good.
CATCH , MESSAGE , ON_ERROR , and Controlling Errors .