/sys$common/syshlp/helplib.hlb FORTRAN, Statements, PARAMETER *Conan The Librarian (sorry for the slow response - running on an old VAX) |
Associates a symbolic name with a constant value. Statement format: 1. 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. 2. PARAMETER p=c [,p=c]... p Is a symbolic name. c Is a constant, the symbolic name of a constant, or a compile-time constant expression. This statement is similar to the one described above; they both assign a symbolic name to a constant. However, this PARAMETER statement differs from the other one in the following two ways: its list is not bounded with parentheses; and the form of the constant, rather than implicit or explicit typing of the symbolic name, determines the data type of the variable.
|