Enterprise COBOL for z/OS, Version 4.2, Programming Guide

Handling tables

A table is a collection of data items that have the same description, such as account totals or monthly averages; it consists of a table name and subordinate items called table elements. A table is the COBOL equivalent of an array.

This image shows a one-dimensional table and associated storage layout.Link to detail.

In the example above, SAMPLE-TABLE-ONE is the group item that contains the table. TABLE-COLUMN names the table element of a one-dimensional table that occurs three times.

Rather than defining repetitious items as separate, consecutive entries in the DATA DIVISION, you use the OCCURS clause in the DATA DIVISION entry to define a table. This practice has these advantages:

Tables are important for increasing the speed of a program, especially one that looks up records.



Rate this page

[ Index | Table of contents ]