Compaq AAQ2G1FTK Marine Radio User Manual


 
Handling Tables
4.1 Defining Tables
Figure 4–8 Memory Map for Example 4–9
Level 03
Longword number
Byte number
Level 01
123
0 0 0 0 0 0 0 0 0 1 1 1
1 2 3 4 5 6 7 8 9 0 1 2
78
ZK6045GE
456
ATABLE
1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3
3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
GROUPG GROUPG GROUPG GROUPG
1 3 3 3 2 2 2 2 1 3 3 3 2 2 2 2 1 3 3 3 2 2 2 2 1 3 3 3 2 2 2 2Level 05
Legend: 1 = ITEM1
2 = ITEM2
3 = ITEM3
If, however, you place ITEM3 after ITEM2, the additional 3 bytes add their own
length plus another fill byte. The additional fill byte is added after the third
ITEM3 character to ensure that all occurrences of the table element are mapped
in an identical manner. Now, each element requires 12 bytes, and the complete
table occupies 48 bytes. This is illustrated by Example 4–10 and Figure 4–9.
Example 4–10 How Adding 3 Bytes Adds 4 Bytes to the Element Length
01 A-TABLE.
03 GROUP-G OCCURS 4 TIMES.
05 ITEM1 PIC X.
05 ITEM2 PIC 9(5) COMP SYNC.
05 ITEM3 PIC XXX.
Note that GROUP-G begins on a 4-byte boundary because of the way Compaq
COBOL allocates memory.
Figure 4–9 Memory Map for Example 4–10
123456
Level 03
Longword number
Byte number
Level 01
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
. . .
. . .
. . .
. . .
. . .
ATABLE
f f f 2 2 2 2 3 3 3 f1 1 f f f 2 2 2 2 3 3 3 f
Legend: 1 = ITEM1
2 = ITEM2
3 = ITEM3
f = fill byte
GROUPG GROUPG
Level 05
ZK6046GE
Handling Tables 4–9