TNS/E Native Application Conversion Guide

Developing a Conversion Strategy
TNS/E Native Application Conversion Guide529659-003
2-6
Determining Data Alignment
the optimization level for the native COBOL and pTAL compilers. The native compilers’
default optimization level is 1.
For C, C++, and pTAL, optimization can be set on a module or procedure basis.
Therefore, native programs can contain modules or procedures compiled at different
optimization levels. This hybrid approach can be used to improve program
performance while maintaining as much symbolic debugging support as possible. With
this 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
IF symbolic debugging is important for analyzing failures
Use full optimization (optimization level 2):
If performance is critical
If 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
If failures are difficult to reproduce in a development environment with a less
optimized version of the program
If a hybrid approach is too complicated
For performance reasons, optimization level 0 is rarely used outside of a development
environment.
You can run Native 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
Native 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 an issue for the COBOL compiler only when level-01 or level-77 data
items are used.
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