Initializing Values Of Table Elements; Initializing Tables With The Value Clause; Initializing A Table With The Occurs Clause; Memory Map For Example 4–11 - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

Handling Tables

4.2 Initializing Values of Table Elements

4.2 Initializing Values of Table Elements
You can initialize a table that contains only DISPLAY items to any desired value
in either of the following ways:
You can specify a VALUE clause in the record level preceding the record
description of the item containing the OCCURS clause.
You can specify a VALUE clause in a record subordinate to the OCCURS
clause.
Example 4–11 and Figure 4–10 provide an example and memory map of a table
initialized using the VALUE clause.
Example 4–11 Initializing Tables with the VALUE Clause
01 A-TABLE VALUE IS "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".
03 MONTH-GROUP PIC XXX USAGE DISPLAY
Figure 4–10 Memory Map for Example 4–11
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
M
Level 03
Byte contents
J A N F E B M A R A P R
Legend: M = Month−Group
If each entry in the table has the same value, you can initialize the table as
shown in Example 4–12.
Example 4–12 Initializing a Table with the OCCURS Clause
01 A-TABLE.
03 TABLE-LEG OCCURS 5 TIMES.
05 FIRST-LEG
05 SECOND-LEG PIC S9(9) COMP VALUE 5.
In this example, there are five occurrences of each table element. Each element
is initialized to the same value as follows:
FIRST-LEG occurs five times; each occurrence is initialized to A.
4–10 Handling Tables
OCCURS 12 TIMES.
2
3
. . .
A−TABLE
. . .
M
M
M
. . .
PIC X VALUE "A".
7
8
2 2 2 2 2 3 3 3 3 3 3 3
5 6 7 8 9 0 1 2 3 4 5 6
M
M
M
S E P O C T N O V D E C
ZK−6047−GE
9
M

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?

Table of Contents