Example of structure mapping

The following example shows the application of the structure mapping rules for a structure with the specified declaration.
  declare 1 A aligned,
            2 B fixed bin(31),
            2 C,
              3 D float decimal(14),
              3 E,
                4 F entry,
                4 G,
                  5 H character(2),
                  5 I float decimal(13),
                4 J fixed binary(31,0),
              3 K character(2),
              3 L fixed binary(20,0),
            2 M,
              3 N,
                4 P fixed binary(15),
                4 Q character(5),
                4 R float decimal(2),
              3 S,
                4 T float decimal(15),
                4 U bit(3),
                4 V char(1),
              3 W fixed bin(31),
            2 X picture '$9V99';

The minor structure at the deepest logical level is G, so this is mapped first. Then E is mapped, followed by N, S, C, and M, in that order.

For each minor structure, a table in Figure 1 shows the steps in the process, and a diagram in Figure 2 shows a visual interpretation of the process. Finally, the major structure A is mapped as shown in Figure 8. At the end of the example, the structure map for A is set out in the form of a table (Figure 9) showing the offset of each member from the start of A.

Figure 1. Mapping of example structure
Mapping of example structure
Figure 2. Mapping of minor structure G
Mapping of minor structure G
Figure 3. Mapping of minor structure E
Mapping of minor structure E
Figure 4. Mapping of minor structure N
Mapping of minor structure N
Figure 5. Mapping of minor structure S
Mapping of minor structure S
Figure 6. Mapping of minor structure C
Mapping of minor structure C
Figure 7. Mapping of minor structure M
Mapping of minor structure M
Figure 8. Mapping of major structure A
Mapping of major structure A
Figure 9. Offsets in final mapping of structure A
Offsets in final mapping of structure A