Context:
Procedure Division Statements
Where: identifier is the name of the list or dictionary collection type.
The following reads an element from a list collection:
declare val as string read stringList into val key 0
The following example, shows exception handling and catching an exception on reading an invalid key in a dictionary collection:
display "reading an invalid key message : " read stringDictionary into val key "RUBBISH" invalid key display "Caught invalid key" not invalid key display "Shouldn't see this" end-read
See also the Collections sample, which is available from Start > All Programs > Micro Focus Visual COBOL > Samples , under Language Reference for JVM COBOL (Windows) or $COBDIR/demo (UNIX).