Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
COMMON
◄Up► ◄Contents► ◄Index► ◄Back►
─────COMMON─────────────────────────────────────────────────────────────────
Action
Shares variables between two or more program units.
Syntax
COMMON [/[cname] [ [attrs] ]/] nlist [ [,]/[cname][attrs]/nlist ]...
Parameter Description
cname A name for the common block.
[attrs] A list of attributes, separated by commas.
Valid attributes are: ALIAS, C, FAR, NEAR,
and PASCAL.
nlist A list of variable names, array names, and
array declarators, separated by commas.
Formal-argument names, function names,
automatic variables, and allocatable arrays
cannot appear in a COMMON statement.
Remarks
A common block can appear more than once in the same program
unit. If two common blocks have the same name, the second is
treated as a continuation of the first.
The length of a common block equals the number of bytes required
to hold all elements in that common block. If several program
units refer to the same named common block, the common block must
be the same length in each program unit. The blank common block
can have a different length in different program units.
Example
PROGRAM MyProg
COMMON i, j, x, k(10)
COMMON /mycom/ a(3)
.
.
.
END
SUBROUTINE MySub
COMMON pe, mn, z, idum(10)
COMMON /mycom/ a(3)
.
.
.
END
-♦-