02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

COMMON<br />

Specifies common blocks.<br />

Syntax<br />

COMMON [/[[common-block-name]]/] object-list<br />

[,]/[common-block-name]/ object-list]...<br />

common-block-name<br />

object-list<br />

Description<br />

is the name of a labeled common block.<br />

<strong>HP</strong> <strong>Fortran</strong> statements<br />

COMMON<br />

is a comma-separated list of scalar variables, arrays, records, and<br />

derived-type objects. If an array is specified, it may be followed by an<br />

explicit-shape specification expression.<br />

The COMMON statement defines one or more storage areas to be shared by different program<br />

units. It also identifies the objects—that is, variables, arrays, records, and derived-type<br />

objects—to be stored in those areas. Objects in common that are shared by different program<br />

units are made accessible by storage association.<br />

Each object following a common-block name is declared to be in that common block. If<br />

/common-block-name/ is omitted, all objects in the corresponding object-list are specified<br />

to be in blank common. It is also possible to declare variables in blank common by specifying<br />

two slashes without common-block-name. Consider the following examples:<br />

!Declare variables a, b, c in blank common.<br />

COMMON a, b, c<br />

! Declare pay and time in blank common,<br />

! and red in the named common block color.<br />

COMMON pay, time, /color/red<br />

! Variables a1 and a2 are in common block a; array x and variable<br />

! are in blank common; and variable d is in common block c<br />

COMMON/a/a1,a2,//x(10),y,/c/d<br />

Any common block name or blank common specification can appear more than once in one or<br />

more COMMON statements within the same program unit. The variable list following each<br />

successive appearance of the same common block name is treated as a continuation of the list<br />

for that common block name. For example, the following COMMON statements:<br />

Chapter 10 267

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!