Matching complex data items such as C structure (struct) items or arrays is more involved. The challenge arises in trying to match the FILLER that may follow the COBOL data items. For example, consider the following group item:
01 GROUP-1. 03 DATA-1 PIC X(5). 03 INT-1 SIGNED-INT.
Assuming that each item is allocated 4 bytes, this would seem to match the following C structure:
struct { char data_1[5]; int int_1; } group_1;
However, it most likely won't match up with the default structure packing due to alignment. If you must match complex C data types, you can take one of three approaches:
Most C compilers align structure elements according to their own needs. The automatic synchronization that occurs with variable-size data items matches the most natural alignment boundaries. But the automatically synchronized data items may not match with the alignment rules used by a particular C compiler. As a result, you may find yourself forced to make some code adjustments for a particular machine.