Context:
Procedure Division Statements
The type-specifier section of the PERFORM..USING phrase must specify a type that implements the System.IDisposable interface, and must specify an initial value via the = expression syntax.
A variable can be declared at the point of use in an iterator, and its scope is until the end of the perform block.
*> In this case, the scope of i is until the end of the perform block. perform varying i as binary-long from 1 by 1 until i > 10 display i end-perform *> So the i in the following perform block is a new instance of i, *> independent of the i in the preceding perform block. perform varying i as binary-short from 0 by 1 until i > 10 display i end-perform
Here, k is declared inline to iterate through a dictionary. Again, it is in scope until the corresponding end-perform.
01 dict1 dictionary[string string]. create dict1 write dict1 from "Anthony" key "A" write dict1 from "Brian" key "B" write dict1 from "Charles" key "C" perform varying key k as string value val as string through dict1 display k ":" val end-perform perform varying value val as string through dict1 display val end-perform perform varying key k as string through dict1 display k end-perform
See also the Local Variables sample, available in the Samples Browser. See To start the Samples Browser for instructions.