Summary:
The DISPLAY instruction displays text in line mode to the standard output channel.
DISPLAY expression [,...]
You can use this instruction to display information to the standard output channel.
The values contained in variables are formatted based on the data type and environment settings.
01
MAIN02
DISPLAY "Today's date is: ", TODAY03
END MAIN
The ERROR instruction displays an error message to the user.
ERROR expression [,...] [ ATTRIBUTE ( display-attribute [,...] ) ]
The ERROR instruction displays an error message to the user.
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 front end configuration.
Possible attributes that can be used as display-attribute:
Attribute | Description |
STYLE = string | The name of a Presentation Style. |
BLACK, BLUE, CYAN, GREEN, MAGENTA, RED, WHITE, YELLOW | The color of the displayed text. |
BOLD, DIM, INVISIBLE, NORMAL | The font attribute of the displayed text. |
REVERSE, BLINK, UNDERLINE | The video attribute of the displayed text. |
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 with more sophisticated visual effects as the regular TTY attributes. Advanced automatic rendering can be obtained with Message specific style attributes. Note that 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.
01
MAIN02
WHENEVER ERROR CONTINUE03
DATABASE stock04
WHENEVER ERROR STOP05
IF sqlca.sqlcode THEN06
ERROR "Connection failed (" || sqlca.sqlcode || ")"07
END IF08
END MAIN
The MESSAGE instruction displays a message to the user.
MESSAGE message [,...] [ ATTRIBUTE ( display-attribute [,...] ) ]
The MESSAGE instruction displays a message to the user.
In TUI mode, the text is displayed in the Comment Line of the current window. In GUI mode, the text is displayed in a specific area, depending on the front end configuration.
Possible attributes that can be used as display-attribute:
Attribute | Description |
STYLE = string | The name of a Presentation Style. |
BLACK, BLUE, CYAN, GREEN, MAGENTA, RED, WHITE, YELLOW | The color of the displayed text. |
BOLD, DIM, INVISIBLE, NORMAL | The font attribute of the displayed text. |
REVERSE, BLINK, UNDERLINE | The video attribute of the displayed text. |
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 with more sophisticated visual effects as the regular TTY attributes. Advanced automatic rendering can be obtained with Message specific style attributes. Note that if you want to apply automatically a style to all program messages displayed with the MESSAGE instruction, you can use the :message pseudo selector in the style definition.
01
MAIN02
WHENEVER ERROR CONTINUE03
DATABASE stock04
WHENEVER ERROR STOP05
IF sqlca.sqlcode THEN06
ERROR "Connection failed (" || sqlca.sqlcode || ")"07
ELSE08
MESSAGE "Connected to database." ATTRIBUTE (STYLE="info3")09
END IF10
END MAIN