COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Values Undefined When SIZE ERROR Phrase is Absent
When a size error condition occurs during execution of a statement for which the SIZE ERROR
phrase is not specified, a trap 2 (arithmetic overflow) occurs unless a NOTRAP2 directive has
suspended arithmetic overflow trapping. If a NOTRAP2 directive has suspended arithmetic
overflow trapping, results are undefined.
NOTE: The ECOBOL compiler, which has traps set by default, ignores the NOTRAP2 directive
and issues a warning.
Use the NOTRAP2 directive only during the process of conversion from COBOL 74 to
HP COBOL. It is provided to enable programs that do not include SIZE ERROR phrases to be
compiled and executed in HP COBOL without investing programmer time in analyzing the
potential for overflow problems. The availability of this directive might be discontinued in
HP COBOL after a period of time.
Values Remain Untouched When SIZE ERROR Phrase is Present
When a size error condition occurs during execution of an arithmetic statement for which the
SIZE ERROR phrase is specified, the value of the affected receiving data items is not altered.
That is, these data items retain whatever values they held before the size error condition arose.
Unaffected data items receive new values as expected. The program has no mechanism by
which it can determine which data items were the cause of the size error condition.
SIZE ERROR, NOT SIZE ERROR, and Transfer of Control
After completion of the execution of the arithmetic operations, if the size error condition
occurred, the imperative statement in the SIZE ERROR phrase is executed. If execution of the
imperative statement causes explicit transfer of control (due to a procedure branching or
conditional statement) control is transferred according to the rules for that statement; otherwise,
when the imperative statement has been executed, control passes to the end of the arithmetic
statement and the NOT SIZE ERROR phrase (if any) is ignored.
When no size error condition occurs during the execution of an arithmetic statement, the SIZE
ERROR phrase (if any) is ignored, and control passes to the NOT SIZE ERROR phrase (if one
is present) or to the end of the arithmetic statement. If execution of the imperative statement
causes explicit transfer of control (due to a procedure branching or conditional statement),
control is transferred according to the rules for that statement.
CORRESPONDING Phrase and the Size Error Condition
When the CORRESPONDING phrase appears in an ADD or SUBTRACT statement and any
of the individual operations produces a size error condition, the imperative statement in the
SIZE ERROR phrase is not executed until all the individual additions or subtractions are
completed.
FROM Phrase
The FROM phrase is an optional component of the RELEASE, REWRITE, and WRITE statements, all
of which specify a record-name as their primary operand. The identifier in the FROM phrase and
the record-name must not reference the same storage area or overlapping storage areas.
The result of executing a statement that specifies the FROM phrase is equivalent to the execution
of these statements in this order:
1. “MOVE identifier TO record-name” executed in accordance with the rules specified for the
MOVE statement
2. The same RELEASE, REWRITE, or WRITE statement without the FROM phrase
After execution of the actual statement is complete, the information in the storage area specified
by the identifier is available, even though the information in the area specified by record-name is
not available (except as specified by the SAME AREA clause).
246 Procedure Division