DECLARE Statement

Declares one or more local variables within the procedure division body. The scope of any inline local variable is from the point of declaration until the end of the innermost containing block, where paragraphs, sections and the whole method are considered to be blocks.

declare-statement

GUID-F772A985-2BEE-4F53-9B90-5384D821CE4B-low.png
GUID-CEC56D88-6C6A-4208-92CE-8B1D363CE254-low.png

Example

       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")

See also the Local Variables sample, which is available from $COBDIR/demo.