You can define aggregates in any of the storage classes or pass them as parameters to a called function. The first step is to find the start of the aggregate. You can compute the start of the aggregate as described in previous sections, depending on the type of aggregate used.
The aggregate map provided for each declaration in a routine can further assist in finding the offset of a specific variable within an aggregate. Structure maps are generated using the AGGREGATE compiler option. Figure 1 shows an example of a static aggregate.
static struct {
short int ss01;
char ss02[56];
int sz0[6];
int ss03;
} ss0;
Figure 2 shows an example aggregate map.
================================================================================
| Aggregate map for: ss0 |
================================================================================
| Offset | Length | Member Name |
| Bytes(Bits) | Bytes(Bits) | |
====================|===================|=======================================
| 0 | 2 | ss01 |
| 2 | 56 | ss02[56] |
| 58 | 2 | ***PADDING*** |
| 60 | 24 | sz0[6] |
| 84 | 4 | ss03 |
================================================================================
Assume the structure has been compiled as RENT. To find the value of variable sz0[0]:
========================================================================
| Writable Static Map |
========================================================================
OFFSET LENGTH FILE ID INPUT NAME
0 1 00001 DFHC0011
4 1 00001 DFHC0010
8 2 00001 DFHDUMMY
C 2 00001 DFHB0025
10 2 00001 DFHB0024
14 2 00001 DFHB0023
18 2 00001 DFHB0022
1C 2 00001 DFHB0021
20 2 00001 DFHB0020
24 2 00001 DFHEIB0
28 4 00001 DFHEIPTR
2C 4 00001 DFHCP011
30 4 00001 DFHCP010
34 4 00001 DFHBP025
38 4 00001 DFHBP024
3C 4 00001 DFHBP023
40 4 00001 DFHBP022
44 4 00001 DFHBP021
48 4 00001 DFHBP020
4C 4 00001 DFHEICB
50 4 00001 DFHEID0
54 4 00001 DFHLDVER
58 320 00001 @STATIC
ss0 66-0:66 Class = static, Location = GPR13(96), Length = 4
Add this offset to the result from step 2. The result is X'2D66EF8' (X'2D66E98' + X'60'). This is the address of the value of the static variable in the dump.
Add the offset from the Aggregate Map to the address of the ss0 struct. The result is X'60' (X'3C' + X'60'). This is the address of the values of sz0 in the dump.