Top: f77 Up: 13 - Statements
Previous: 13,46 - OPTIONS Next: 13,48 - PAUSE
Section 13,47: PARAMETER
Associates a symbolic name with a constant value. Statement
format:
PARAMETER (p=c [,p=c]...)
p Is a symbolic name.
c Is a constant, a compile-time expression, or the
symbolic name of a constant.
The following additional rules apply to symbolic names:
- 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.
A compile-time expression can contain the following intrinsic
subprograms as long as the operands are constants: ABS, CHAR,
CMPLX, CONJG, DIM, DPROD, IAND, ICHAR, IEOR, IMAG, IOR, ISHFT, LGE,
LGT, LLE, LLT, MIN, MAX, MOD, NINT, and NOT.
For information on an alternate syntax for PARAMETER, see Help
topic: Compatibility_Features PARAMETER.
Top: f77 Up: 13 - Statements
Previous: 13,46 - OPTIONS Next: 13,48 - PAUSE