pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-8
Running Programs With Overflow Traps Disabled
Running Programs With Overflow Traps Disabled
The operating system enables overflow traps when it starts a process; therefore, if your
program does not specify any overflow trapping compiler directives, procedure
attributes, or block attributes, traps will be enabled throughout the run of your program
as a TNS or native process.
If you want to run your entire program with overflow traps disabled:
Specify the NOOVERFLOW_TRAPS compiler directive at the beginning of the
program so that it runs with overflow traps disabled as a native process,
Specify the DISABLE_OVERFLOW_TRAPS block attribute in the BEGIN-END
block that defines the body of your program’s main procedure so that your pTAL
program runs with overflow traps disabled as a TNS process.
Comparing Overflow Trapping in Native Processes
When you run a pTAL program as a native process, the overflow trapping directives,
procedure attributes, and block attributes determine at compile time the program’s
trapping behavior. For example, if you specify an OVERFLOW_TRAPS compiler
directive, overflow trapping is enabled throughout your program, unless you specify a
NOOVERFLOW_TRAPS compiler directive or procedure attribute, or a
DISABLE_OVERFLOW_TRAPS block attribute.
When you run a pTAL program as a TNS process, each procedure inherits the trapping
state of its callers. You can specify the trapping state of a called procedure by
specifying a block-level attribute on the BEGIN-END block that encloses the body of
the procedure:
PROC p;
BEGIN: ENABLE_OVERFLOW_TRAPS
...
END;
You can ensure the trapping state of an entire program that you compile with the TAL
compiler by specifying overflow trapping attributes on the BEGIN-END block of your
“main” procedure:
PROC my_main MAIN;
BEGIN: DISABLE_OVERFLOW_TRAPS
...
END;
PROC s;
BEGIN: DISABLE_OVERFLOW_TRAPS
CALL p; ! Call p with traps disabled
END;
Example 20-4. ENABLE_OVERFLOW_TRAPS Block Attribute (page 2 of 2)