COBOL Manual for TNS and TNS/R Programs

Program Compilation
HP COBOL Manual for TNS and TNS/R Programs522555-006
11-134
TRAP2-74 and NOTRAP2-74
If you compile the main program with the COBOL85 compiler, and include the
NOTRAP2 directive, the compiler does not activate the arithmetic overflow trapping
mechanism. This then approximates the behavior of COBOL 74, although any
undefined results could have values that are different from those a COBOL 74 program
would produce.
An example of this behavior is a counter that the program increments by 1 until the
value of the counter exceeds its maximum value, and rolls over to zero.
TRAP2-74 and NOTRAP2-74
TRAP2-74
overrides the NOTRAP2-74 directive.
NOTRAP2-74
specifies that if the current HP COBOL program traps arithmetic overflow, then the
HP COBOL code must suspend arithmetic overflow trapping before calling a
COBOL 74 program and restore trapping upon return from the COBOL 74
program.
In object code produced by the HP COBOL 74 compiler, if a size error condition occurs
in an arithmetic computation for which no SIZE ERROR phrase is present, the
computation produces an undefined result (unpredictable value).
Note. The NMCOBOL compiler, which cannot call COBOL 74 programs, ignores these
directives and issues warnings.
Use the NOTRAP2-74 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.
Default: TRAP2-74
Placement: Anywhere
Scope: The last TRAP2-74 or NOTRAP2-74 before the END PROGRAM
statement for the outermost program applies to the entire separately
compiled program (the outermost program of a compilation and any
programs contained within it).
Dependencies: NOTRAP2-74 overrides TRAP2.
References: TRAP2 and NOTRAP2
TRAP2-74
NOTRAP2-74
VST329.vsd