DECLARE 文

手続き部本文内でローカル変数を 1 つ以上宣言します。インライン ローカル変数の範囲は、宣言のポイントから最奥の包含ブロックの最後までです。段落、節、メソッド全体は、ブロックと見なされます。

コンテキスト:

    手続き部 
        

declare-statement

       declare i1 as binary-long
       display i1 
         
       *>   Optionally, the variables can be initialised inline 
        declare c2 as condition-value = true
        display c2

        declare string-list2 as string occurs 3 = table of string("Bill", "Ben", "LittleWeed")

ローカル変数のサンプルも参照してください。このサンプルは、[スタート> すべてのプログラム > Micro Focus Visual COBOL > サンプル] の [COBOL for JVM] (Windows) または $COBDIR/demo (UNIX) にあります。