WRITE Collection Statement (.NET COBOL)

Writes an element to the list or dictionary.

write-collection-statement

Syntax for the Write statement
Note: Other formats of this statement are available. See Statements in the COBOL Language Reference.

Example

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 Visual COBOL > Samples, under COBOL for .NET .