The type of table which has been considered above is known as one-dimensional table. Whenever a table is such that each of its elements in turn is a table of one dimension, it is known as the two-dimensional table. The illustration of a two-dimensional table is as shown below:
02 BRANCH-FIGURES OCCURS 18 TIMES.
03 MONTHLY-SALES PIC 9(6) V99 OCCURS 12
The table is supposed to store monthly sales figures for 12 months for each of the 18 branches of an organization. Keep in mind that this is a two-dimensional table as each of the 18 BRANCH-FIGURES is itself a table having 12 elements. It might be further noted that a reference to an element of a two-dimensional table needs two subscripts. We should specify the branch as well as the month so that the preferred element is identified. Therefore, the MONTHLY-SALES (3, 5) means that the sales figure for fifth month of the third branch. Because of the organization identified in the above description of the table, the initial subscript implicitly refers to the branch and the second subscript to the month. The two-dimensional table has been separated first into 18 one-dimensional tables through the entry at level 02. Each of such tables has then been defined by the entry at level 03. This organization can be shown diagrammatically as:
If needed, the tables for the individual branches can be referred to by the name BRANCH-FIGURE with only one subscript specifying the branch. Therefore the BRANCH-FIGURE (4) will show the monthly sales table for the fourth branch. \