Associates a symbolic name with a constant value.
The PARAMETER attribute can be specified in a type declaration
statement or an PARAMETER statement, and takes one of the following
forms:
Type Declaration Statement:
type, [att-ls,] PARAMETER [,att-ls] :: p=c [,p=c]...
Statement:
PARAMETER (p=c [,p=c]...)
type Is a data type specifier.
att-ls Is an optional list of attribute specifiers.
p Is the symbolic name of the constant.
c Is a constant, a compile-time expression, or the
symbolic name of a constant.
If the symbolic name is used as the length specifier in a CHARACTER
declaration, it must be enclosed in parentheses.
If the symbolic name is used as a numeric item in a FORMAT edit
description, it must be enclosed in angle brackets.
The symbolic name of a constant cannot appear as part of another
constant, although it can appear as either the real or imaginary
part of a complex constant.
A symbolic name can be defined only once within the same program
unit.
You can only use a symbolic name defined to be a constant within
the program unit containing the defining PARAMETER statement.
The data type of a symbolic name associated with a constant is
determined as follows:
- By an explicit type declaration statement preceding the
defining PARAMETER statement
- By the same rules for implicit declarations that determine the
data type of any other symbolic name
For example, the following PARAMETER statement is interpreted
as MU=1 (MU has an integer data type by implication):
PARAMETER (MU=1.23)
If the PARAMETER statement is preceded by an appropriate type
declaration or IMPLICIT statement, it could be interpreted as
MU=1.23; for example:
REAL*8 MU
PARAMETER (MU=1.23)
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 PARAMETER attribute is compatible with the PRIVATE and PUBLIC
attributes.
For information on an alternate syntax for PARAMETER, see Help
topic: COMPATIBILITY_FEATURES PARAMETER.