TNS/R Native Application Migration Guide

Developing a Migration Strategy
TNS/R Native Application Migration Guide523745-001
2-5
Determining Data Alignment
For C, C++, and pTAL optimization can be set on a module or procedure basis. Thus,
native programs can contain modules or procedures compiled at different optimization
levels. This hybrid approach can be taken to improve program performance but
maintain as much symbolic debugging support as possible. With this hybrid approach,
you compile performance-critical code at optimization level 2 and the remainder at
optimization level 1. The Measure PROCESS entity can be used to select the
performance-critical procedures.
Use a hybrid approach (optimization level 2 and level 1) if:
Performance is important
Symbolic debugging is important for analyzing failures
Use full optimization (optimization level 2) if:
Performance is critical
Failures can often be reproduced in a development environment using a less
optimized version of the program
Use intermediate optimization (optimization level 1) if:
Performance is rarely critical
Failures are difficult to reproduce in a development environment with a less
optimized version of the program
A hybrid approach is too complicated
The program is written in native COBOL85
For performance reasons, optimization level 0 is rarely used outside of a development
environment.
You can run Inspect on code compiled at optimization level 2. However, the ability to
set breakpoints, step through code, and display variables is limited. For more details
on how optimization impacts symbolic debugging, see the Inspect Manual.
For additional performance information, see the performance document for a given
RVU.
Determining Data Alignment
By default, the native compilers align data and generate code assuming that data
misalignment traps do not occur. If a program is not sensitive to how a compiler
allocates consecutive fields in structures, use the default data alignment. Data
alignment is not an issue for the NMCOBOL compiler.
If a program is sensitive to how a compiler allocates structures, specify the
FIELDALIGN CSHARED2 and REFALIGNED 2 pragmas in C and C++ and the
FIELDALIGN SHARED2 and REFALIGNED 2 directives in pTAL. These pragmas and
directives ensure that the native compilers align data the same as TNS compilers.