HP 3000 Manuals

OFF ERROR [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

OFF ERROR 

Execution of the OFF ERROR statement deactivates any ON ERROR statement
that affects the program unit containing the OFF ERROR statement.

Syntax 

OFF ERROR

If a program unit executes an OFF ERROR statement and then calls another
program unit, any previous ON ERROR statement is inactive in the called
program unit also.

If the OFF ERROR statement is in a subunit, the last previous ON ERROR
statement is reactivated when control returns to the calling program
unit.

The following program segment illustrates OFF ERROR.

Examples 

     100 ON ERROR CALL Error
     105 I=J/0                   !Trapped by line 100 ON ERROR
     110 CALL Sub1
     120 I=J/0                   !Trapped by line 100 ON ERROR
     130 END
     200 SUB Sub1
     210   I=J/0                 !Trapped by line 100 ON ERROR
     220   OFF ERROR
     225   I=J/0                 !Not trapped
     230   CALL Sub2
     240   I=J/0                 !Not trapped
     300 SUB Sub2
     310   I=J/0                 !Not trapped
     320   CALL Sub3
     400 SUB Sub3
     410   I=J/0                 !Not trapped
     420   ON ERROR GOTO 430
     425   I=J/0                 !Trapped by line 420 ON ERROR
     430   PRINT "Error at 425"
     440 SUBEND
     500 SUB Error
     510   PRINT "Error at 105, 120, or 210"
     515   I=0
     520 SUBEND



MPE/iX 5.0 Documentation