Initializing Mixed Usage Items; Memory Map For Example 4–13 - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

SECOND-LEG occurs five times; each occurrence is initialized to 5.
Often a table is too long to initialize using a single literal, or it contains numeric,
alphanumeric, COMP, COMP-1, COMP-2, or COMP SYNC items that cannot be
initialized. In these situations, you can initialize individual items by redefining
the group level that precedes the level containing the OCCURS clause. Consider
the sample table descriptions illustrated in Example 4–13 and Example 4–14.
Each fill byte between ITEM1 and ITEM2 in Example 4–13 is initialized to X.
Figure 4–11 shows how this is mapped into memory.
Example 4–13 Initializing Mixed Usage Items
01 A-RECORD-ALT.
05 FILLER PIC XX VALUE "AX".
05 FILLER PIC S99 COMP VALUE 1.
05 FILLER PIC XX VALUE "BX".
05 FILLER PIC S99 COMP VALUE 2.
.
.
.
01 A-RECORD REDEFINES A-RECORD-ALT.
03 A-GROUP OCCURS 26 TIMES.
05 ITEM1 PIC X.
05 ITEM2 PIC S99 COMP SYNC.
Figure 4–11 Memory Map for Example 4–13
Longword number
Byte number
1
Level 01
Level 03
1
Level 05
Byte contents
A
binary 1
Legend: 1 = ITEM1
2 = ITEM2
f = fill byte
As shown in Example 4–14 and in Figure 4–12, each FILLER item initializes
three 10-byte table elements.
4.2 Initializing Values of Table Elements
1
2
3
4
5
A−RECORD
A−GROUP
A−GROUP
f
2
2
1
X
B
X
binary 2
Handling Tables
2
6
7
8
. . .
. . .
. . .
f
2
2
. . .
. . .
ZK−6048−GE
Handling Tables 4–11

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents