CONDITION condition

Status
CONDITION is always enabled.
Result
The CONDITION condition allows you to establish an ON-unit that will be executed whenever a SIGNAL statement for the appropriate CONDITION condition is executed.

As a debugging aid, the CONDITION condition can be used to establish an ON-unit that prints information about the current status of the program.

Cause and syntax
The CONDITION condition is raised by a SIGNAL statement. The name specified in the SIGNAL statement determines which CONDITION condition is raised. The ON-unit can be executed from any point in the program through placement of a SIGNAL statement. Normal rules of name scope apply. A condition name is external by default, but can be declared INTERNAL.
The following example shows the use of the CONDITION condition.
dcl Test condition;

 
on condition (Test)
begin;
⋮
end;
The begin-block is executed whenever the following statement is executed:
  signal condition (Test);

Read syntax diagramSkip visual syntax diagramCONDITION( name)
Abbreviation
COND
Implicit action
A message is printed and execution continues with the statement following SIGNAL.
Normal return
Execution continues with the statement following the SIGNAL statement.
Condition code
500