CONDITION condition

Establishes an ON-unit executed when a SIGNAL statement for the appropriate CONDITION condition is executed.

Enabled/Disabled status

Always enabled.

Result

Enables you to establish an ON-unit that is executed when a SIGNAL statement for the appropriate CONDITION condition is executed.

Raised

By a SIGNAL statement, where the name of the SIGNAL statement matches a condition name, and thus specifies which condition is raised. The program can execute the ON-unit from any point, and then through placement of a SIGNAL statement.

Notes

You can use CONDITION condition as a debugging aid to establish an ON-unit that prints information about the current status of the program.

Normal rules of name scope apply. A condition name is external by default, but can be declared INTERNAL.

This condition allows the user to establish an ON-unit that will be executed whenever a SIGNAL statement is executed specifying CONDITION and a name that matches the name in the ON statement.

Example

The following is an example of an ON CONDITION statement:

ON CONDITION(OVERDRAFT) BEGIN; 

   PUT SKIP LIST('ACCOUNT HAD AN OVERDRAFT ON'||DATE())');

END;
.
.
.
IF ACCOUNT_BALANCE < TOTAL WITHDRAWAL THEN SIGNAL CONDITION(OVERDRAFT);

Other information

Abbreviation
COND
Condition codes
No unique condition codes.
Implicit action
Prints a message, and then continues execution with the statement following SIGNAL.
Normal return
Continues execution with the statement following SIGNAL.