Getting Started with TRANSACT (32247-90007)
Chapter 6 101
Data Structures
Figure 6-11. COBOL Array Definitions
This would be implemented in Transact as follows:
Figure 6-12. Comparable Transact Array Definitions
Line 1 defines the total number of occurrences (10) and total byte length of each occurrence
(40) of the one-dimensional array.
Line 2 defines one occurrence of employee data to be 40 bytes long. In a later section, we
will see how to access array items by subscripting or using the LET(OFFSET) verb.
Lines 3-5 define detail items making up one employee record. The total byte length of all
these fields adds up to the 40 bytes that makes up one record.
Line 6 starts a new array definition.
1 01 empl-table.
2 02 empl-rec occurs 10.
3 04 empl-no pic x(6).
4 04 empl-name pic x(30).
5 04 empl-salary pic 9(8)v99 comp.
6
7 01 reg-sales-by-mo.
8 02 region-line occurs 10.
9 04 region pic x(4).
10 04 month pic 9(8) comp occurs 12.
1 define(item) empl-table 10 x(40):
2 empl-rec x(40)=empl-table:
3 empl-no x(6)=empl-rec:
4 empl-name x(30)=empl-rec(7):
5 empl-salary i(10,2)=empl-rec(37):
6 reg-sales-by-mo 10 x(52):
7 region-line x(52)=reg-sales-by-mo:
8 region x(4)=region-line:
9 month-data 12 i(8)=region-line(5):
10 month i(8)=month-data;
11 list empl-table:
12 reg-sales-by-mo;