COBOL Manual for TNS and TNS/R Programs

Migrating TNS Programs to Native Programs
HP COBOL Manual for TNS and TNS/R Programs522555-006
33-6
Data Alignment
6. Compile your source program with the NMCOBOL or ECOBOL compiler.
For the Guardian environment, see Running the Compiler. For the OSS
environment, see Section 19, Using HP COBOL in the OSS Environment.
The NMCOBOL or ECOBOL compiler needs more symbol table space than the
COBOL85 compiler does. If the NMCOBOL or ECOBOL compilation fails due to
dictionary overflow, use the PARAM SYMBOL-BLOCKS command to increase the
space available for the symbol table and embedded SQL/MP statements and then
recompile.
7. Run the HP COBOL program that you compiled in Step 6.
8. If necessary, debug the program.
The debuggers handle native processes slightly differently than TNS processes.
The debuggers have environment registers for TNS processes, but not for native
processes; therefore, variables might remain in memory and never be written to
memory—it depends on compiler optimization level.
Data Alignment
On TNS systems, a word is 16 bits. The TNS instruction set includes data access
instructions that use 32-bit byte addresses that must be even-byte aligned (that is,
aligned 0 modulo 2) for correct operation. In TNS mode and accelerated mode,
addresses that are odd-byte aligned (that is, aligned 1 modulo 2) are called misaligned.
TNS processors consistently “round down” misaligned addresses (that is, they ignore
the low-order bit).
TNS/R and TNS/E processors handle the misaligned addresses of TNS programs
inconsistently, rounding down some but not others and behaving differently in TNS
mode and accelerated mode. Compilers cannot catch misaligned addresses that are
computed at run time.
The behavior of TNS programs with misaligned addresses on TNS/R and TNS/E
processors is almost impossible to predict. If you are not sure that your program has
only aligned addresses, you can use the tracing facility to detect whether programs are
using misaligned pointers and, if so, where. You should then change the programs to
avoid misalignment.
The round-downs occur only in TNS-compiled programs, not in TNS/R and TNS/E
native programs. In native mode, unexpected misalignments can slow down a
program, but they cannot cause errors.