次の例では、クラスが定義されます。このクラスには、値の割り当てと取得を行う手段として簡単なゲッタとセッタがあります。配列へのアクセスに使用される角括弧では、0 ベースの索引付けを使用します。丸括弧では 1 ベースの索引付けを使用します。
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.
プロパティのサンプルの IndexerDemo.cbl も参照してください。このサンプルは、[ スタート > すべてのプログラム > Micro Focus Enterprise Developer > Samples] のCOBOL for JVM の下にあります。