Scope of local variables
A local variable is valid within the statement block in which it is defined and within any nested statement blocks, unless you redefine the variable within the statement block.
In the
beginning of the SPL procedure in the following figure, the integer
variables x, y, and z are defined and initialized.
The BEGIN and END statements mark a nested statement block in which the integer variables x and q are defined as well as the CHAR variable z. Within the nested block, the redefined variable x masks the original variable x. After the END statement, which marks the end of the nested block, the original value of x is accessible again.