Condition prefixes

You can use a condition prefix to specify whether some conditions are enabled or disabled. If a condition is enabled, the compiler generates any extra code needed in order to detect the condition. If a condition is disabled, the compiler generates no extra code to detect it.

Disabling a condition is equivalent to asserting that the condition cannot occur; if it does, your program is in error. For instance, if the SUBSCRIPTRANGE condition is enabled, the compiler generates extra code to ensure that any array index is within the bounds of its array. If the SUBSCRIPTRANGE condition is disabled, the extra code is not generated and using an invalid array index leads to unpredictable results.

If a condition is detected by hardware, disabling the condition has no effect.

You can specify a condition prefix only for eligible conditions.

Read syntax diagramSkip visual syntax diagram(,condition):statement;
condition
Some conditions are always enabled, and cannot be disabled. Some are enabled unless you disable them, and some are disabled unless you enable them. The conditions are listed in Conditions.
statement
Condition prefixes are not valid for DECLARE, DEFAULT, FORMAT, OTHERWISE, END, ELSE, ENTRY, and %statements. For information about the scope of condition prefixes, see Scope of the condition prefix.
In the following example, (size): is the condition prefix. The conditional prefix indicates that the corresponding condition is enabled within the scope of the prefix.
  (size):  L1:  X=(I**N) / (M+L);

To enable conditions, specify the condition prefix with the condition name. To disable conditions, specify the condition prefix with the condition name, preceded by NO without intervening blanks.

Types and status of conditions are shown in Table 1.


Table 1. Classes and status of conditions
Class and conditions Status
Computational (for data handling, expression evaluation, and computation)  
ASSERTION Always enabled
CONVERSION Enabled by default
FIXEDOVERFLOW Enabled by default
INVALIDOP Enabled by default
OVERFLOW Enabled by default
UNDERFLOW Always enabled
ZERODIVIDE Enabled by default
Input/Output  
ENDFILE Always enabled
ENDPAGE Always enabled
KEY Always enabled
NAME Always enabled
RECORD Always enabled
TRANSMIT Always enabled
UNDEFINEDFILE Always enabled
Program checkout (useful for developing/debugging a program)  
SIZE Disabled by default
STRINGRANGE Disabled by default
STRINGSIZE Disabled by default
SUBSCRIPTRANGE Disabled by default
Miscellaneous  
ANYCONDITION Always enabled
AREA Always enabled
ATTENTION Always enabled
CONDITION Always enabled
ERROR Always enabled
FINISH Always enabled
STORAGE Always enabled

For information about the performance effects of enabling and disabling conditions, refer to the Programming Guide.