In the following example, a class is defined and provided with simple getter and setters as a means of assigning and retrieving values. Square brackets used to access arrays, use 0-based indexing. Round brackets use 1-based indexing.
class-id SimpleIndexer.
01 myArray string occurs 100.
indexer-id string.
procedure division using by value i as binary-long.
getter.
set property-value to myArray[i]
setter.
set myArray[i] to property-value
end indexer.
end class.
See also the IndexerDemo.cbl in the Properties sample, available from Start > All Programs > Micro Focus Studio Enterprise Edition x.x > Samples, under COBOL for .NET .