COBOL uses the term Table. But it has similarities like an array
Table Vs Array
What is a TableMultiple occurrences of similar data item you can call it as a Table. The items in a Table starts with ‘1’ and goes to maximum of Size. In a Table each element is subordinate to another element.
What is an ArrayAn array is similar to table. Here, you can store multiple occurrences similar data items. The only difference is in an Array, the items start with ‘0’ and goes to ‘n-1’ maximum items. Arrays does not have any relation between one element to other. The first item you can refer as i(0), i(1) and so on.
How to Define a Table or ArraySome people define the array in ‘COPY’ book. Other programmers use both definition and usage in the same program. Definition for multi dimension array is as follows:
01 Table occurs 10 times. 03 field-1 pic x(03). 03 sub-table pic 9(5) occurs 5 times. 03 field-2 pic 9(03).The OCCURS clause will be used to define the size of a Table. You can define a subscript to refer your table element.
01 Sub1 PIC 9(01) value 1.You need a definition for subscript. It is initialized with ‘1’.
Move field-1(sub1) TO WS_FIELD.The internal meaning is:
MOVE field-1(1) TO WS_FIELD.