MF 

The 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.

General Formats for Format 1

DECLARE Statement
NETJVM 

General Formats for Format 2

General Rules for Format 1

  1. In native COBOL, local data items are statically scoped, but (unlike .NET COBOL local items) they are not perform-range-local: if you re-enter a paragraph or section, fresh copies of any associated local data items are not created.

Example

       01 names pic x(10) typedef.
       ...
       declare i1 as binary-long
       display i1 
         
       *>   Optionally, the variables can be initialised inline 
        declare c2 as binary-long = 5
        display c2

        declare name-list as names occurs 3