Chapter 12. Array Processing and Table Handling
To familiarize you with
How to establish a series of items using an
How to access and manipulate data stored in an array or table.
The rules for using an
OCCURSclause in the
The use of a
SEARCH ALLfor a table look-up.
AN INTRODUCTION TO SINGLE-LEVEL OCCURS CLAUSES
Why OCCURS Clauses Are Used
We use an
OCCURS clause in COBOL to indicate the repeated occurrence of fields with the same format. We will focus first on some uses of an
Using an OCCURS to Define a Series of Input Fields Each with the Same Format
Defining Fields with an OCCURS Clause
Suppose we have one 72-character input record that consists of 24 hourly temperature fields. Each field is three positions long and indicates the temperature for a given city at a particular hour. Using traditional methods, coding the input record with 24 independent hourly fields would prove cumbersome:
01 TEMP-REC. 05 ONE-AM PIC S9(3). 05 TWO-AM PIC S9(3). . . . . . . 05 MIDNIGHT PIC S9(3).
We use the S in the
PIC clause for cities in which ...