basic.onerr Definition/BASIC Program

basic.onerr

Command basic.onerr Definition/BASIC Program
Applicable release versions: AP
Category BASIC Program (486)
Description identifies the statements to execute when an error occurs during commands which perform operations on peripheral storage devices.

The "system(0)" function contains the error message associated with the "onerr" condition.

The "onerr" condition is used in the same construct as the "then/else" construct.

Either an "onerr" clause or an "else" clause is allowed in a statement, but not both. They are similar, in that they are taken when the peripheral operation takes a decision-point or failure path. The "onerr" form provides a great deal more functionality, but at a higher cost. When the "onerr" clause exists, all media handling must be handled by the program. This means, for example, that the program is responsible for handling an "end of reel" condition, thus the program would have to prompt the operator for the next reel. By contrast, the "else" clause would handle the same situation by passing through the standard system routine to "mount next reel and press 'c' to continue".
Syntax onerr statement.block
Options
Example
readt tape.rec onerr
  crt "oops. we've got a system(0) error of " : system(0)
end

In this example, the "onerr" path is taken in the event of any 
abnormal condition, and it simply displays the value of system(0).

readt tape.rec onerr
    condition = system(0)
    begin case
    case condition = 1
         print "tape is NOT attached..."
    case condition = 5
         print "process end of reel"
    case condition = 6
         print "tape is write-protected"
    end case
end

This example illustrates how processing for an error could be divided out based 
upon the error which occured.
Purpose
Related basic.readt
basic.readtl
basic.readtx
basic.then
basic.then/else.construct
statement.block
tcl.t-att
basic.weof
basic.else
basic.writet
basic.rewind
basic.system