beautypg.com

Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual

Page 91

background image

Lexical Elements of the DEC Text Processing Utility Language

4.9 Reserved Words

If an error or warning is generated during a CALL_USER routine, ERROR is
set to a keyword that represents the failure status of the routine, ERROR_
LINE is set to the line number of the error, and ERROR_TEXT is set to
a warning or error message that is placed in the message buffer. Finally,
DECTPU runs the error handler code.

For other warnings and errors, ERROR is set to a keyword that represents
the error or warning, ERROR_LINE is set to the line number of the error,
and ERROR_TEXT is set to the error or warning message associated with
the keyword. DECTPU places error messages in the message buffer but
suppresses the display of warning messages. Finally, DECTPU runs the error
handler code.

If an error or warning is generated during execution of a procedural error handler,
DECTPU behaves as follows:

If you press Ctrl/C during the error handler, DECTPU puts an error message
in the message buffer, exits from all currently active procedures (in their
reverse calling order), and returns to the ‘‘wait for next key’’ loop.

For other errors and warnings, the appropriate error or warning message
is written to the message buffer. DECTPU resumes execution at the next
statement after the statement that generated the error.

4.9.4.16 Case-Style Error Handlers

Case-style error handlers provide a number of advantages over procedural error
handlers. With case-style error handlers, you can do the following:

Suppress the automatic display of both warning and error status messages

Trap the TPU$_CONTROLC status

Write clearer code

Syntax

ON_ERROR [condition_1]: statement_1;... [condition_2]: statement_2;... . . .
[condition_n]: statement_n; ENDON_ERROR;

You can use the [OTHERWISE] selector alone in an error handler as a shortcut.
For example, the following two error handlers have the same effect:

! This error handler uses [OTHERWISE] alone as a shortcut.

ON_ERROR
[OTHERWISE] : ;
ENDON_ERROR

! This error handler has the same effect as using
! [OTHERWISE] alone.

ON_ERROR
[OTHERWISE] :

LEARN_ABORT;
RETURN (FALSE);

ENDON_ERROR;

Example 4–11 from the EVE editor shows a procedure with a case-style error
handler.

Lexical Elements of the DEC Text Processing Utility Language 4–25