The COMMON statement provides a global data facility. It specifies contiguous blocks of physical storage, called common blocks, that are available to any program unit that references the common block.
SyntaxCOMMON [/common-name/] common-object-list[, /common-name/ common-object-list]...Where:
common-name is the name of the common block being declared.
common-object-list is a comma-separated list of data objects that are to be included in the common block.
If common-name is present, all data objects in the corresponding common-object-list are specified to be in the named common block common-name.
If common-name is omitted, all data objects in the following common-object-list are specified to be in blank common.
For each common block, a contiguous storage sequence is formed for all data objects, in the order they appear in common-object-list in the program unit.
A given data object can appear only once in all common-object-lists in a program unit.
A blank common has the same properties as a named common, except:
A common block name or blank common can appear multiple times in one or more COMMON statements in a program unit. In such case, the common-object-list is treated as a continuation of the common-object-list for that common block.
A data object in a common-object-list must not be a dummy argument, an allocatable array, an automatic object, a function name, an entry name, or a result name, and it must have a name made available by use association.
Each bound in an array-valued data object in a common-object-list must be an initialization expression.
Any data object must only become associated with an object having the same attributes, type, kind, length, or rank.
If a data object in a common-object-list has an explicit shape, it cannot have the pointer attribute.
If a data object in a common-object-list is of a derived type, the derived type must have the sequence attribute.
Derived type data objects in which all components are of default numeric or LOGICAL types can become associated with data objects of default numeric or LOGICAL types.
Derived type data objects in which all components are of default CHARACTER type can become associated with data objects of type CHARACTER.
An EQUIVALENCE statement must not cause the storage sequences of two different common blocks to become associated.
An EQUIVALENCE statement must not cause storage units to be added before the first storage unit of the common block.
If any storage sequence is associated by equivalence association with the storage sequence of the common block, the sequence can be extended only by adding storage units beyond the last storage unit.
Examplecommon /first/ a,b,c ! a, b, and c are in named ! common /first/ common d,e,f, /second/, g ! d, e, and f are in blank ! common, g is in named ! common /second/ common /first/ h ! h is appended to /first/