7.2.3 Creating Arrays with the COMMON Statement
Create arrays with the COMMON statement when you
need an array of fixed-length strings, or when you want to
share an array among program modules. Program mod-
ules can share arrays in COMMON statements by defining a
common block with the same name.
The COMMON statements in the following programs create
a 100-element array of fixed-length strings, each element
10 characters long. Because the main program and subpro-
grams use the same common name, the storage for these
arrays is overlaid when the programs are linked. Therefore,
both programs can read and write data to the array.
!Main Program
COMMON (ABC) STRING access_list(1 TO 100) = 10
!Subprogram
SUB SUB1
COMMON (ABC) STRING new_list(1 TO 100) = 10