TNS/R Native Application Migration Guide

Developing a Migration Strategy
TNS/R Native Application Migration Guide523745-001
2-4
Determining Optimization Levels
In some cases, two logically equivalent but syntactically different fragments of code
might be required: one for the TNS compilers and one for the native compilers. Such
code can be isolated within a source file for conditional compilation:
For source code compiled with both the pTAL and TAL compilers, you must first check
the syntax of the program with the pTAL compilers syntax checking option and then
compile the program with the TAL compiler. The D31 TAL compiler supports but does
not check most pTAL language features.
Determining Optimization Levels
The native C, native C++, and pTAL compilers support three levels of optimization—0,
1, and 2. The native COBOL25 compiler supports two levels of optimization—0 and 1.
Use optimization level 0 until you have debugged your program and then use
optimization level 1 or 2.
The optimize pragma (in the Guardian environment) and the -Woptimize c89 flag
(in the OSS environment) set the optimization level for the native C and C++ compilers.
The OPTIMIZE directive sets the optimization level for the NMCOBOL and pTAL
compilers. The native compilers’ default optimization level is 1.
Language For conditional compilation, use ... For more information, see ...
C
C++
#ifdef macros C/C++ Programmer’s Guide
COBOL85 IF, IFNOT, ENDIF, SETTOG, and
RESETTOG directives
COBOL85 for NonStop Systems
Manual
pTAL IF directives pTAL Reference Manual
Optimization Level Characteristics
0, None
Slower execution
Supports symbolic debugging
Data always in memory
Useful during development and migration; not intended for
production
1, Intermediate
Faster execution
Supports symbolic debugging
Data not always in memory
Useful in production
2, Full
Fastest execution (on average, a 15 percent reduction in
pathlength over level 1)
Limited support for symbolic debugging
Data not always in memory
Useful in production