HP 3000 Manuals

On Call Statements and Compiled Subunits [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

On Call Statements and Compiled Subunits 

The following example illustrates the behavior of the ON ERROR CALL
statement across compiled subunit calls.  The ON HALT CALL and ON END
CALL statements behave the same way.

Examples 

            Interpreted Program                          External Subunits 
---------------------------------------------------------------------------------------

     10 ON ERROR CALL Errsub                     100 SUB Extproc
      20 GLOBAL EXTERNAL Extproc                 110 ON ERROR CALL Blob
      30 CALL First_sub                          120 CALL Squiggle
            .                                           .
            .                                           .
            .                                           .
     500 SUB First_sub                           400 SUBEND
            .                                    410 SUB Squiggle
            .                                    420 PRINT 1/0
            .                                    430    .
     600 CALL Extproc                                   .
     610 PRINT 1/0                                      .
            .                                    500 SUBEND
            .                                    510 SUB Blob
            .                                           .
     700 SUBEND                                         .
     720 SUB Errsub                                     .
            .                                    590 SUBEND
            .
            .
     800 SUBEND

Line             Result of Executing Line 

10               Errsub will handle errors.

600              Control transfers to Extproc.  Now Errsub does not
                 handle errors.

110              Blob will handle errors.

420              Error occurs (division by zero).  Control transfers to
                 Blob.

590              Control returns to line 430.

400              Control returns to First_sub (line 610).  Now Errsub
                 handles errors again.

610              Error occurs (division by zero).  Control transfers to
                 Errsub.



MPE/iX 5.0 Documentation