HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
COMMON
Chapter 10 301
COMMON
Specifies common blocks.
Syntax
COMMON [/[[
common-block-name
]]/]
object-list
[,]/[
common-block-name
]/
object-list
]...
common-block-name
is the name of a labeled common block.
object-list
is a comma-separated list of scalar variables, arrays, records, and
derived-type objects. If an array is specified, it may be followed by an
explicit-shape specification expression.
Description
The COMMON statement defines one or more storage areas to be shared by different program
units. It also identifies the objects—that is, variables, arrays, records, and derived-type
objects—to be stored in those areas. Objects in common that are shared by different program
units are made accessible by storage association.
Each object following a common-block name is declared to be in that common block. If
/
common-block-name
/ is omitted, all objects in the corresponding
object-list
are specified
to be in blank common. It is also possible to declare variables in blank common by specifying
two slashes without
common-block-name
. Consider the following examples:
!Declare variables a, b, c in blank common.
COMMON a, b, c
! Declare pay and time in blank common,
! and red in the named common block color.
COMMON pay, time, /color/red
! Variables a1 and a2 are in common block a; array x and variable
! are in blank common; and variable d is in common block c
COMMON/a/a1,a2,//x(10),y,/c/d
Any common block name or blank common specification can appear more than once in one or
more COMMON statements within the same program unit. The variable list following each
successive appearance of the same common block name is treated as a continuation of the list
for that common block name. For example, the following COMMON statements: