The PARAMETER statement discussed here is similar to the one discussed in Section 4.12; they both assign a symbolic name to a constant. However, this PARAMETER statement differs from the other one in the following ways:
This PARAMETER statement takes the following form:
PARAMETER p = c [,p = c] . . .
Each symbolic name p becomes a constant and is defined as the value of the constant or constant expression c. Once a symbolic name is defined as a constant, it can appear in any position in which a constant is allowed. The effect is the same as if the constant were written there instead of the symbolic name.
The symbolic name of a constant cannot appear as part of another constant, except as the real or imaginary part of a complex constant. For example:
PARAMETER I=3 PARAMETER M=I.25 ! Not allowed PARAMETER N=(1.703, I) ! Allowed
You can use symbolic names in a PARAMETER statement only to identify the symbolic name's corresponding constant in that program unit. Such a name can be defined only once in PARAMETER statements within the same program unit.
The symbolic name of a constant assumes the data type of its corresponding constant expression. The data type of a parameter constant cannot be specified in a type declaration statement. Nor does the initial letter of the constant's name implicitly affect its data type.
The following are valid examples of this form of the PARAMETER statement:
PARAMETER PI=3.1415927, DPI=3.141592653589793238D0 PARAMETER PIOV2=PI/2, DPIOV2=DPI/2 PARAMETER FLAG=.TRUE., LONGNAME='A STRING OF 25 CHARACTERS'
For details on compile-time constant expressions, see Section 4.12.