Local data items are data items (also known as variables) that are declared in the procedure division body.
- For native COBOL, type-specifier can be one of the following:
- BINARY-CHAR [UNSIGNED]
- BINARY-SHORT [UNSIGNED]
- BINARY-LONG [UNSIGNED]
- BINARY-DOUBLE [UNSIGNED]
JVM COBOL type specifiers, refer to the
Type Specifier link below.
- When declaring a local data item derived from a user type definition, that type definition must be an elementary data item.
- The scope of any inline local variable is from the point of declaration until the end of the innermost containing block, where
paragraphs and sections are considered to be blocks.
01 names pic x(10) typedef.
declare i1 as binary-long
declare name-list as names occurs 3
*> Optionally, the variables can be initialised inline
declare c2 as binary-long = 5
perform varying k as binary-long from 4 by 1 until K > 6