OVERFLOW


The OVERFLOW statement provides a means for intercepting numeric overflow conditions which can be caused by division by zero or by a result too large to be stored in a numeric destination field. The OVERFLOW statement specifies a label in much the same manner as a GOTO statement.

    ••••• OVERFLOW ••••••••••••••••••••••••••••••
    (1)            (2)

(1) T/F execution conditions

(2) Label

Using the Statement

If a statement subsequent to the OVERFLOW statement references a numeric field and causes an overflow condition, processing control is transferred to the statement immediately following the specified label. The LABEL statement referenced by the OVERFLOW statement can be anywhere in the same event point as the OVERFLOW.

The OVERFLOW statement may be respecified at any time with another label, or the intercept may be disabled by an OVERFLOW statement with no label specified. Intercepts are automatically disabled when the event point that they are contained in is complete.

Compilation Errors

A process compile error occurs if the referenced LABEL is not defined within the same event point as the OVERFLOW statement, and also not defined in any ILF subroutines copied into the event point with the COPY statement.

Related Statements

CALC, COMPUTE, COPY, LABEL, SET, SET TOT

Example

In the following example, the OVERFLOW statement prevents the event point from failing with an overflow condition caused either by WORK AVG SALES not being large enough to store the integer component of WORK TOTAL SALES or by a division by zero error should the number of salesreps be zero.

          OVERFLOW :WORK AVG SALES OVERFLOW
          SET      TAR WORK AVG SALES             =  TAR WORK TOTAL SALES
          COMPUTE  TAR WORK AVG SALES             /  TAR WORK NO SALESREPS
          GOTO     :DISPLAY RESULTS
          *
          LABEL    :WORK AVG SALES OVERFLOW
          SET      TAR WORK AVG SALES             =      0
          WARNING  Numeric Overflow - WORK AVG SALES set to zero!
          *
          LABEL    :DISPLAY RESULTS
          DISPLAY  TAR WORK AVG SALES