READ コレクション文

リストまたは辞書の要素を指定のキーから読み取ります。

Context:

    手続き部
        

read-collection-statement

注: Other formats of this statement are available. See in the COBOL 言語リファレンス.

Where: identifier is the name of the list or dictionary collection type.

次の例では、リスト集合から要素を読み取ります。

       declare val as string
       read stringList into val key 0

次の例に、辞書集合の無効なキーを読み取るときの例外処理と例外捕捉を示します。

       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 

集合のサンプルも参照してください。このサンプルは、 Start > All Programs > Micro Focus Visual COBOL > Samples , under COBOL for JVM (Windows) or $COBDIR/demo (UNIX). に用意されています。