Context:
Procedure Division Statements
![]() |
The following declares and creates a list collection and then writes an element to the list:
declare stringList as list[string]
create stringList
write stringList from "item 0"
The following writes 5 more elements to the list using a perform loop:
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 displayListContents(stringList)
See also the Collections sample, which is available from Start > All Programs > Micro Focus Enterprise Developer > Samples > Visual COBOL Samples, under COBOL for JVM.