Figure 4–8 Memory Map for Example 4–9
1
Longword number
0 0 0 0 0 0 0 0 0 1 1 1
Byte number
1 2 3 4 5 6 7 8 9 0 1 2
Level 01
GROUP−G
Level 03
Level 05
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 2
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
Longword number
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2
Byte number
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
Level 01
Level 03
Level 05
1
f
Legend: 1 = ITEM1
2 = ITEM2
3 = ITEM3
f = fill byte
2
3
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
GROUP−G
1
2
3
GROUP−G
f
f 2 2 2 2 3 3 3 f
4
5
6
A−TABLE
GROUP−G
4
5
A−TABLE
GROUP−G
1 f
f
f 2 2 2 2 3 3 3 f
Handling Tables
4.1 Defining Tables
7
8
GROUP−G
ZK−6045−GE
. . .
6
. . .
. . .
. . .
. . .
ZK−6046−GE
Handling Tables 4–9
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?
Questions and answers