4.12 PARAMETER Statement

The PARAMETER statement associates a symbolic name with a constant value. It takes the following form:

PARAMETER (p = c[,p = c] . . . )
p
Is a symbolic name.
c
Is a constant, a compile-time constant expression, or the symbolic name of a constant.

Rules and Behavior

The data type of a symbolic name associated with a constant is determined as follows:

Once a symbolic name is associated with a constant, it can appear anywhere in a program that any other constant can appear-except in FORMAT statements (where constants can only be used in variable format expressions) and as the character count for Hollerith constants. For compilation purposes, writing the name is the same as writing the value.

The following additional rules apply to symbolic names:

Compile-Time Constant Expressions

A compile-time constant expression can be a logical, character, or arithmetic expression.

A compile-time logical expression has the following characteristics:

A compile-time character expression has the following characteristics:

A compile-time arithmetic expression has the following characteristics:

Example

The following example shows valid Fortran PARAMETER statements:

REAL*4 PI, PIOV2
REAL*8 DPI, DPIOV2
LOGICAL FLAG
CHARACTER*(*) LONGNAME
PARAMETER (PI=3.1415927, DPI=3.141592653589793238D0)
PARAMETER (PIOV2=PI/2, DPIOV2=DPI/2)
PARAMETER (FLAG=.TRUE., LONGNAME='A STRING OF 25 CHARACTERS')

For More Information:


Previous Page Next Page Table of Contents