SIC has a powerful error recovery system. Every command returns to the SIC monitor a status to indicate if any error occured. If so, by default SIC attempts to make a PAUSE. In an interactive session, there is a (presumably intelligent) user to decide what to do, and who can hopefully correct the error (a typing mistake for example) and then type CONTINUE to proceed. In a non-interactive session (Batch or command procedure), no such intelligent decision is possible and the PAUSE causes an Abort of the program.
If keypad edition is possible, the command which caused the error is automatically displayed for correction by the user. The prompt is put in inverse video to indicate that edition is going on. The corrected line will be submitted whenever <RETURN> or <ENTER> keys are pressed.
It is possible to override this default behaviour by command
ON ERROR [Other command]After this command has been issued, any error will attempt to execute the "Other command". If this command happens to fail, SIC will try to make a PAUSE. This command can be any command of the program, including @, CONTINUE, EXIT, NEXT. They will behave exactly has usual, except command QUIT.
In interactive mode, the QUIT command is usually typed to abort an erroneous procedure. In this case, it decreases the execution level by 2, and transmit an error to this new level to signal an abnormal end of some procedure. In error recovery mode, QUIT directly transmit the error to the previous level. It is in fact translated into RETURN ERROR.
Judicious use of the ON ERROR command may enable you to make batch jobs very conveniently. In particular, think of the behaviour of ON ERROR NEXT and ON ERROR BREAK when using loops, and ON ERROR RETURN when using procedures.
The ON ERROR command is a local command: that means it is only valid within the procedure which declared it (and loops executed within this procedure). However, if a PAUSE occured from a procedure (or loop), an interactive execution of the ON ERROR command will reset the error processing behaviour of the interrupted procedure.