REGIONAL Command Example

In the following example, two sets of regional variables are created. In region 1, the variables gcA, gcB, gcC, and gcD are created, and the character string "One" is stored to each. In region 2, the variables gcC, gcD, gcE and gcF are created, and the character string "Two" is stored to each. The variables gcC and gcD are common to both regions.

The output from DISPLAY MEMORY is then shown. The names of variables gcC and gcD are modified in the second region. gcC becomes GCC________2, and gcD becomes GCD________2. All the variables are private and can be accessed by lower-level programs.

#REGION 1
REGIONAL gcA,gcB,gcC,gcD
STORE 'One' to gcA,gcB,cgC,gcD
#REGION 2
REGIONAL gcC,gcD,gcE,gcF     && gcC and gcD are common to both regions
STORE 'Two' to gcC,gcD,gcE,gcF
DO showmemory

PROCEDURE showmemory
DISPLAY MEMORY LIKE g*