18 SCOPES AND CLASSES OF SYMBOLIC NAMES

A symbolic name consists of one to six alphanumeric characters, the first of which must be a letter. Some sequences of characters, such as format edit descriptors and keywords that uniquely identify certain statements, for example, GO TO, READ, FORMAT, etc, are not symbolic names in such occurrences nor do they form the first characters of symbolic names in such occurrences.

18.1 Scope of Symbolic Names

The scope of a symbolic name is an executable program, a program unit, a statement function statement, or an implied-DO list in a DATA statement.

The name of the main program and the names of block data subprograms, external functions, subroutines, and common blocks have a scope of an executable program.

The names of variables, arrays, constants, statement functions, intrinsic functions, and dummy procedures have a scope of a program unit.

The names of variables that appear as dummy arguments in a statement function statement have a scope of that statement.

The names of variables that appear as the DO-variable of an implied-DO in a DATA statement have a scope of the implied-DO list.

18.1.1 Global Entities.

The main program, common blocks, subprograms, and external procedures are global entities of an executable program. A symbolic name that identifies a global entity must not be used to identify any other global entity in the same executable program.

18.1.1.1 Classes of Global Entities.

A symbolic name in one of the following classes is a global entity in an executable program:
  1. Common block
  2. External function
  3. Subroutine
  4. Main program
  5. Block data subprogram

18.1.2 Local Entities.

The symbolic name of a local entity identifies that entity in a single program unit. Within a program unit, a symbolic name that is in one class of entities local to the program unit must not also be in another class of entities local to the program unit. However, a symbolic name that identifies a local entity may, in a different program unit, identify an entity of any class that is either local to that program unit or global to the executable program. A symbolic name that identifies a global entity in a program unit must not be used to identify a local entity in that program unit, except for a common block name and an external function name ( 18.2.1 and 18.2.2).

18.1.2.1 Classes of Local Entities.

A symbolic name in one of the following classes is a local entity in a program unit.
  1. Array
  2. Variable
  3. Constant
  4. Statement function
  5. Intrinsic function
  6. Dummy procedure

A symbolic name that is a dummy argument of a procedure is classified as a variable, array, or dummy procedure. The specification and usage must not violate the respective class rules.

18.2 Classes of Symbolic Names

In a program unit, a symbolic name must not be in more than one class except as noted in the following paragraphs of this section. There are no restrictions on the appearances of the same symbolic name in different program units of an executable program other than those noted in this section.

18.2.1 Common block.

A symbolic name is the name of a common block if and only if it appears as a block name in a COMMON statement ( 8.3).

A common block name is global to the executable program.

A common block name in a program unit may also be the name of any local entity other than a constant, intrinsic function, or a local variable that is also an external function in a function subprogram. If a name is used for both a common block and a local entity, the appearance of that name in any context other than as a common block name in a COMMON or SAVE statement identifies only the local entity. Note that an intrinsic function name may be a common block name in a program unit that does not reference the intrinsic function.

18.2.2 External Function.

A symbolic name is the name of an external function if it meets either of the following conditions:
  1. The name appears immediately following the word FUNCTION in a FUNCTION statement or the word ENTRY in an ENTRY statement within a function subprogram.
  2. It is not an array name, character variable name, statement function name, intrinsic function name, dummy argument, or subroutine name, and every appearance is immediately followed by a left parenthesis except in a type-statement, in an EXTERNAL statement, or as an actual argument.

In a function subprogram, the name of a function that appears immediately after the word FUNCTION in a FUNCTION statement or immediately after the word ENTRY in an ENTRY statement may also be the name of a variable in that subprogram ( 15.5.1). At least one such function name must be the name of a variable in a function subprogram.

An external function name is global to the executable program.

18.2.3 Subroutine.

A symbolic name is the name of a subroutine if it meets either of the following conditions:
  1. The name appears immediately following the word SUBROUTINE in a SUBROUTINE statement or the word ENTRY in an ENTRY statement within a subroutine subprogram.
  2. The name appears immediately following the word CALL in a CALL statement and is not a dummy argument.

A subroutine name is global to the executable program.

18.2.4 Main Program.

A symbolic name is the name of a main program if and only if it appears in a PROGRAM statement in the main program.

A main program name is global to the executable program.

18.2.5 Block Data Subprogram.

A symbolic name is the name of a block data subprogram if and only if it appears in a BLOCK DATA statement.

A block data subprogram name is global to the executable program.

18.2.6 Array.

A symbolic name is the name of an array if it appears as the array name in an array declarator ( 5.1) in a DIMENSION, COMMON, or type-statement.

An array name is local to a program unit.

An array name may be the same as a common block name.

18.2.7 Variable.

A symbolic name is the name of a variable if it meets all of the following conditions:
  1. It does not appear in a PARAMETER, INTRINSIC, or EXTERNAL statement.
  2. It is not the name of an array, subroutine, main program, or block data subprogram.
  3. It appears other than as the name of a common block, the name of an external function in a FUNCTION statement, or an entry name in an ENTRY statement in an external function.
  4. It is never immediately followed by a left parenthesis unless it is immediately preceded by the word FUNCTION in a FUNCTION statement, is immediately preceded by the word ENTRY in an ENTRY statement, or is at the beginning of a character substring name ( 5.7.1).

A variable name in the dummy argument list of a statement function statement is local to the statement function statement in which it occurs. Note that the use of a name that appears in Table 5 as a dummy argument of a statement function removes it from the class of intrinsic functions. A variable name that appears as an implied-DO-variable in a DATA statement is local to the implied-DO list. All other variable names are local to a program unit.

A statement function dummy argument name may also be the name of a variable or common block in the program unit. The appearance of the name in any context other than as a dummy argument of the statement function identifies the local variable or common block. The statement function dummy argument name and local variable name have the same type and, if of type character, both have the same constant length.

The name of an implied-DO-variable in a DATA statement may also be the name of a variable or common block in the program unit. The appearance of the name in any context other than as an implied-DO-variable in the DATA statement identifies the local variable or common block. The implied- DO-variable and the local variable have the same type.

18.2.8 Constant.

A symbolic name is the name of a constant if it appears as a symbolic name in a PARAMETER statement.

The symbolic name of a constant is local to a program unit.

18.2.9 Statement Function.

A symbolic name is the name of a statement function if a statement function statement ( 15.4) is present for that symbolic name and it is not an array name.

A statement function name is local to a program unit. A statement function name may be the same as a common block name.

18.2.10 Intrinsic Function.

A symbolic name is the name of an intrinsic function if it meets all of the following conditions:
  1. The name appears in the Specific Name column or the Generic Name column of Table 5.
  2. It is not an array name, statement function name, subroutine name, or dummy argument name.
  3. Every appearance of the symbolic name, except in an INTRINSIC statement, a type-statement, or as an actual argument, is immediately followed by an actual argument list enclosed in parentheses.

An intrinsic function name is local to a program unit.

18.2.11 Dummy Procedure.

A symbolic name is the name of a dummy procedure if the name appears in the dummy argument list of a FUNCTION, SUBROUTINE, or ENTRY statement and meets one or more of the following conditions:
  1. It appears in an EXTERNAL statement.
  2. It appears immediately following the word CALL in a CALL statement.
  3. It is not an array name or character variable name, and every appearance is immediately followed by a left parenthesis except in a type-statement, in an EXTERNAL statement, in a CALL statement, as a dummy argument, as an actual argument, or as a common block name in a COMMON or SAVE statement.

A dummy procedure name is local to a program unit.


[Contents] [Previous]
This document was translated by troff2html v0.21 on August 16, 1995.