Symbolic names identify entities within a Fortran program unit. These entities are listed in Table 1-1.
A symbolic name can contain letters, digits, and
the special characters: dollar sign ($) and underscore (_).
The first character in a symbolic name must be a letter.
The symbolic name can contain a maximum of 31
characters. (FORTRAN-77 limits the length of a symbolic name
to six characters.)
The following examples show valid and invalid symbolic names:
Valid | |
NUMBER | |
FIND_IT | |
X | |
Invalid | Explanation |
5Q | Begins with a numeral |
B.4 |
Contains a special character other than _ or $ |
$FREQ |
Begins with a $ |
In most cases, a symbolic name can only identify one entity within a program unit. However, symbolic names can be shared among a common block, a structure, a structure field, and any one of the following: a record, an array, or a variable. A PARAMETER constant can share its name with a structure or record field, and a common block.
In the following valid statements, X is the name of a common block, a structure, a structure field, and a variable:
COMMON /X/ I, J STRUCTURE /X/ INTEGER X END STRUCTURE REAL X
In an executable program with two or more program units, the symbolic names of the following entities must be unique within the entire program:
For example, if your program contains a function named BTU, you cannot use BTU as the symbolic name of any other subprogram, entry, or common block in the program, even if the name appears in a different program unit.
Table 1-1 lists those entities that can be given symbolic names and indicates whether the entities can be given data types.
Entity | Data Type Assignable |
---|---|
Variables | Yes |
Arrays | Yes |
Structures | No |
Records | No |
Record elements | Yes |
Statement functions | Yes |
Intrinsic functions | Yes |
Function subprograms | Yes |
Subroutine subprograms | No |
Common blocks | No |
Namelist data groups | No |
Main programs | No |
Block data subprograms | No |
Function entry points | Yes |
Subroutine entry points | No |
Parameter constants | Yes |