HP 3000 Manuals

Arithmetic Traps on Calculations [ COMMUNICATOR 3000 XL, XL Release 1.1 (Core Software Release A.10.00) ] MPE/iX Communicators


COMMUNICATOR 3000 XL, XL Release 1.1 (Core Software Release A.10.00)

Arithmetic Traps on Calculations 

Give programmers the ability to process arithmetic errors on
calculations.

Syntax 

     LET expression[,ERROR=label[([item-name])]];

expression       Current syntax.  The standard form for arithmetic
                 expressions in Transact.

ERROR=           Option to inform the processor to branch on arithmetic
                 traps.

label            Transact program label to branch to upon encountering an
                 arithmetic error.

item-name        The point to which the list register is to be reset
                 before branching to the error label.  If the user does
                 not specify an item-name (i.e.  ERROR=label() or
                 ERROR=label) then the list register is reset to empty.
                 If the user specifies an asterisk (i.e.  ERROR=label(*))
                 then the list register is unchanged.  This is consistent
                 with the "ERROR=" option on the data base and file IO
                 verbs.

Discussion 

This gives Transact programmers the ability to handle arithmetic errors
on calculations from within a Transact application.  Currently, Transact
prints an error message and continues executing upon detecting an
arithmetic error.  In addition to branching, this option will cause the
STATUS register to be set to one of the following values:

  1 - Attempt to assign a negative value to a positive item.

  2 - Invalid arithmetic field for item/invalid decimal digit.

  3 - Divide by zero.

  4 - Overflow.

  5 - Underflow

  6 - LOG, LN, or SQRT function attempted on negative number.

The following Transact/V errors will cause the ERROR= branch to be taken:

USER ERROR 16                  Attempt to assign negative value to an item.

USER ERROR 17                  Invalid arithmetic field for an item.

PROGRAMMER ERROR 46            Decimal divide by zero.

PROGRAMMER ERROR 47            Decimal overflow.

PROGRAMMER ERROR 48            Extended precision divide by zero.

PROGRAMMER ERROR 49            Extended precision underflow.

PROGRAMMER ERROR 50            Extended precision overflow.

PROGRAMMER ERROR 51            Integer overflow.

PROGRAMMER ERROR 52            Floating point overflow.
PROGRAMMER ERROR 53            Floating point underflow.

PROGRAMMER ERROR 54            Integer divide by zero.

PROGRAMMER ERROR 55            Floating point divide by zero.

PROGRAMMER ERROR 76            Attempted LN, LOG, or SQRT function on a negative
                               number.

PROGRAMMER ERROR 81            Invalid decimal digit.

PROGRAMMER ERROR 84            Attempt SQRT function on a number that is < 0.

Example 

     LET (UNIT-PRICE) = (TOTAL-PRICE)/(QUANTITY),ERROR=CALCERROR(UNIT-PRICE);


MPE/iX Communicators