A program unit can access the contents of any common block by quoting its name in a COMMON statement. Common block names are always enclosed in a pair of slashes and can only be used in COMMON and SAVE statements. The common block itself has no data type and has a global name which must be distinct from the names of all program units. The name should also be distinct from all local names in each program units which access the block. Each program unit can make use of any number of different common blocks. There is also a special blank or un-named common block with unique properties which are covered in section 12.2 below.
The variables and arrays within a common block do not have any global status: they are associated with items in blocks bearing the same name in other program units only by their position within the block. Thus, if in one program unit specifies:
COMMON /OBTUSE/ X(3)
and in another:
COMMON /OBTUSE/ A, B, C
then, assuming the data types are the same, X(1) corresponds to A, X(2) to B, and X(3) to C. The COMMON statements here are effectively setting up different names or aliases for the same set of memory locations. The data types do not have to match provided the overall length is the same, but it is generally only possible to transfer information from one program unit to another if the corresponding items have the same data type. If they do not, when one item becomes defined all names for the same location which have a different data type become undefined. There is one minor exception to this rule: information may be transferred from a complex variable (or array element) to two variables of type real (or vice-versa) since these are directly associated with its real and imaginary parts.
Usually it is necessary to arrange for corresponding items to have identical data types; it also minimises confusion if the same symbolic names are used as well. The simplest way to achieve this is to use an INCLUDE statement, if your system provides one. The include-file should contain not only the COMMON statement but also all the associated type and SAVE statements which are necessary. It is, of course, still necessary to recompile every program unit which accesses the common block whenever its definition is altered significantly.