HP 3000 Manuals

COMMON Statement (Nonexecutable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

COMMON Statement (Nonexecutable) 

The COMMON statement specifies a block of storage space that can be used
by more than one program unit.

[]
----------------------------------------------------------------------------------------------- | | | | | Item | Description/Default | Restrictions | | | | | ----------------------------------------------------------------------------------------------- | | | | | block_name | Name of a labeled common block. | Must be different from all | | | | intrinsic names, subroutine names, | | | | and the program name. | | | | | ----------------------------------------------------------------------------------------------- Semantics The following data items cannot appear in a COMMON statement: * The names of formal arguments in a subprogram. * A function, subroutine, or intrinsic function name. As an extension to the ANSI 77 standard, a COMMON statement can contain a name that has been initialized in a DATA statement or a type statement. A variable cannot be specified more than once in the COMMON statements within a program unit. Each omitted block name specifies blank common, which means that a common block name is not specified but the compiler supplies a hidden name. The appearance of two slashes (//) with no block name between them declares the variables that follow to be in blank common. A common block name or blank common specification can appear more than once in one or more COMMON statements in a 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 block name. For example, the COMMON statements: COMMON a,b,c/x/y,z,d//w,r COMMON /cap/hat,visor,//tax,/x/o,t are equivalent to the following COMMON statement: COMMON a,b,c,w,r,tax,/x/y,z,d,o,t,/cap/hat,visor The length of a common block is determined by the number and type of the variables in the list associated with that block. The total size of a COMMON block must be less than one gigabyte. (A gigabyte is 1,073,741,824 (230) bytes.) Common block storage is allocated at link time. It is not local to any one program unit.
NOTE Global data declared in a COMMON block cannot be shared between a calling program and a subprogram in an executable library.
Each program unit that uses the common block must include a COMMON statement that contains the block name (if a name was specified). The list assigned to the common block by the program unit need not correspond to any other program unit by name, type, or number of elements. The only consideration is the size of the common blocks referenced by the different program units. The size of an unlabeled (blank) common block can differ between program units, but the size of a labeled common block should be the same in all program units. As an extension to the ANSI 77 standard, character and noncharacter data can be mixed in a given common block. Examples Notes -------------------------------------------------------------------------------------- COMMON a, b, c The variables a, b, and c are placed in blank common. COMMON pay, time, /color/red The variables pay and time are placed in blank common; the variable red is placed in common block color. COMMON /a/a1,a2,//x(10),y,/c/d The variables a1 and a2 are placed in common block a; x(10) and y are placed in blank common; d is placed in common block c.


MPE/iX 5.0 Documentation