# CHAPTER OBJECTIVES

Upon completion of this chapter, you should be able to

• Establish a series of items using a double-level OCCURS clause.

• Demonstrate how to establish a series of items within a multiple-level array.

• Demonstrate how to look up data stored in a multiple-level array.

• Access and manipulate data defined with a triple-level (or more) OCCURS clause.

# DOUBLE-LEVEL OCCURS CLAUSE

When describing an area of storage, as many as seven levels of OCCURS are permitted.

Like a single-level OCCURS, multiple levels of OCCURS may be used for (1) accumulating totals in an array, or (2) storing a table for "look-up" purposes. We will look first at multiple-level arrays and then at multiple-level tables.

# DEFINING A DOUBLE-LEVEL, OR TWO-DIMENSIONAL, ARRAY

Suppose we wish to establish in storage an array of hourly temperature readings for Los Angeles or any other city during a given week. Once the array is established, it is used to perform various calculations. The array consists of 7 × 24 temperature readings; that is, there are 24 hourly temperature readings for each of 7 days. The array is represented as

To define this array in WORKING-STORAGE with a single-level OCCURS would require the following coding.

The ellipses, or dots (. . .), indicate that 24 elementary ...

Get PROGRAMMING IN COBOL/400: 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.