Avoiding Field Alignment Problems in C/C++ Structures
All fields defined in ILE C/C++ structures are aligned on their natural
boundaries. For example, int fields are four bytes long and are
stored on four-byte boundaries. If you create a file that is externally described,
the system does not enforce boundary alignment of the externally described
data. The structure may need to be packed because packed structures match
the alignment of the externally described data.
If the fields defined in the DDS are aligned (for example, all are character fields), you can use the type definition that is generated without packing the structure.
To avoid an alignment problem, specify the _P option to generate a packed
structure. For example, to include a packed type definition structure of
input and key fields for the record format custrec from
the file EXAMPLE/CUSTMSTL, the following statements must appear
in your program in the order shown below:
#pragma mapinc("custmf","EXAMPLE/CUSTMSTL(custrec)","input key","_P")
...
#include "custmf"