ERROR

The ERROR instruction displays an error message to the user.

Syntax

ERROR expression
  [ ATTRIBUTES ( display-attribute [,...] ) ]
where display-attribute is:
{ BLACK | BLUE | CYAN | GREEN
| MAGENTA | RED | WHITE | YELLOW
| BOLD | DIM | INVISIBLE | NORMAL
| REVERSE | BLINK | UNDERLINE
| STYLE = "style-name"
}
  1. expression is any expression supported by the language.
  2. style-name is a presentation style name.

Usage

The ERROR instruction displays an error message to the user in an interactive program.

In TUI mode, the error text is displayed in the error line of the current window.

In GUI mode, the text is displayed in a specific area, depending on the STYLE attribute.

When you specify the STYLE attribute, you can reference a style defined in the presentation styles file. This allows you to display errors or messages in GUI mode with more sophisticated visual effects as the regular TTY attributes. Advanced automatic rendering can be obtained with message specific style attributes. If you want to apply automatically a style to all program warnings displayed with the ERROR instruction, you can use the :error pseudo selector in the style definition.

Example

...
IF sqlca.sqlcode THEN
  ERROR "Database update failed (" || sqlca.sqlcode || ")"
    ATTRIBUTES(STYLE="important")
    ...
END IF
...