次の例では、リストの集合を宣言して作成してから、リストに要素を書き込みます。
declare stringList as list[string]
create stringList
write stringList from "item 0"
次の例では、perform ループを使用してさらに 5 つの要素をリストに書き込みます。
perform varying i as binary-long from 1 by 1 until i > 5
write stringList from "item " & i
end-perform
display "The contents of the list : "
invoke self::displayListContents(stringList)
集合のサンプルも参照してください。このサンプルは、[スタート > すべてのプログラム > Micro Focus Enterprise Developer > Samples] の COBOL for JVM の下にあります。