# 2 FORTRAN TERMS AND CONCEPTS

This section introduces basic terminology and concepts, some of which are clarified further in later sections. Many terms and concepts of more specialized meaning are also introduced in later sections. The underlined words are described here and used throughout this standard.

## 2.1 Sequence

A sequence is a set ordered by a one-to-one correspondence with the numbers 1, 2, through n . The number of elements in the sequence is n . A sequence may be empty, in which case it contains no elements.

The elements of a nonempty sequence are referred to as the first element, second element, etc. The nth element, where n is the number of elements in the sequence, is called the last element. An empty sequence has no first or last element.

## 2.2 Syntactic Items

Letters, digits, and special characters of the FORTRAN character set ( 3.1) are used to form the syntactic items of the FORTRAN language. The basic syntactic items of the FORTRAN language are constants, symbolic names, statement labels, keywords, operators, and special characters.

The form of a constant is described in Section 4.

A symbolic name takes the form of a sequence of one to six letters or digits, the first of which must be a letter. Classification of symbolic names and restrictions on their use are described in Section 18.

A statement label takes the form of a sequence of one to five digits, one of which must be nonzero, and is used to identify a statement ( 3.4).

A keyword takes the form of a specified sequence of letters. The keywords that are significant in the FORTRAN language are described in Sections 7 through 16. In many instances, a keyword or a portion of a keyword also meets the requirements for a symbolic name. Whether a particular sequence of characters identifies a keyword or a symbolic name is implied by context. There is no sequence of characters that is reserved in all contexts in FORTRAN.

The set of special characters is described in 3.1.4. A special character may be an operator or part of a constant or have some other special meaning. The interpretation is implied by context.

## 2.3 Statements, Comments, and Lines

A FORTRAN statement is a sequence of syntactic items, as described in Sections 7 through 16. Except for assignment and statement function statements, each statement begins with a keyword. In this standard, the keyword or keywords that begin the statement are used to identify that statement. For example, a DATA statement begins with the keyword DATA.

A statement is written in one or more lines, the first of which is called an initial line ( 3.2.2); succeeding lines, if any, are called continuation lines ( 3.2.3).

There is also a line called a comment line ( 3.2.1), which is not part of any statement and is intended to provide documentation.

### 2.3.1 Classes of Statements.

Each statement is classified as executable or nonexecutable (Section 7). Executable statements specify actions. Nonexecutable statements describe the characteristics, arrangement, and initial values of data; contain editing information; specify statement functions; classify program units; and specify entry points within subprograms.

## 2.4 Program Units and Procedures

A program unit consists of a sequence of statements and optional comment lines. A program unit is either a main program or a subprogram.

A main program is a program unit that does not have a FUNCTION, SUBROUTINE, or BLOCK DATA statement as its first statement; it may have a PROGRAM statement as its first statement.

A subprogram is a program unit that has a FUNCTION, SUBROUTINE, or BLOCK DATA statement as its first statement. A subprogram whose first statement is a FUNCTION statement is called a function subprogram. A subprogram whose first statement is a SUBROUTINE statement is called a subroutine subprogram. Function subprograms and subroutine subprograms are called procedure subprograms. A subprogram whose first statement is a BLOCK DATA statement is called a block data subprogram.

### 2.4.1 Procedures.

Subroutines ( 15.6), external functions ( 15.5), statement functions ( 15.4), and the intrinsic functions ( 15.3) are called procedures. Subroutines and external functions are called external procedures. Function subprograms and subroutine subprograms may specify one or more external functions and subroutines, respectively ( 15.7). External procedures may also be specified by means other than FORTRAN subprograms.

### 2.4.2 Executable Program.

An executable program is a collection of program units that consists of exactly one main program and any number, including none, of subprograms and external procedures.

## 2.5 Variable

A variable is an entity that has both a name and a type. A variable name is a symbolic name of a datum. Such a datum may be identified, defined ( 2.11), and referenced ( 2.12). Note that the usage in this standard of the word "variable" is more restricted than its normal usage, in that it does not include array elements.

The type of a variable is optionally specified by the appearance of the variable name in a type-statement ( 8.4). If it is not so specified, the type of a variable is implied by the first letter of the variable name to be integer or real ( 4.1.2), unless the initial letter type implication is changed by the use of an IMPLICIT statement ( 8.5).

At any given time during the execution of an executable program, a variable is either defined or undefined ( 2.11).

## 2.6 Array

An array is a nonempty sequence of data that has a name and a type. The name of an array is a symbolic name.

### 2.6.1 Array Elements.

Each of the elements of an array is called an array element. An array name qualified by a subscript is an array element name and identifies a particular element of the array ( 5.3). Such a datum may be identified, defined ( 2.11), and referenced ( 2.12). The number of array elements in an array is specified by an array declarator ( 5.1).

An array element has a type. The type of all array elements within an array is the same, and is optionally specified by the appearance of the array name in a type-statement ( 8.4). If it is not so specified, the type of an array element is implied by the first letter of the array name to be integer or real ( 4.1.2), unless the initial letter type implication is changed by the use of an IMPLICIT statement ( 8.5).

At any given time during the execution of an executable program, an array element is either defined or undefined ( 2.11).

## 2.7 Substring

A character datum is a nonempty sequence of characters. A substring is a contiguous portion of a character datum. The form of a substring name used to identify, define ( 2.11), or reference ( 2.12) a substring is described in 5.7.1.

At any given time during the execution of an executable program, a substring is either defined or undefined ( 2.11).

## 2.8 Dummy Argument

A dummy argument in a procedure is either a symbolic name or an asterisk. A symbolic name dummy argument identifies a variable, array, or procedure that becomes associated ( 2.14) with an actual argument of each reference ( 2.12) to the procedure ( 15.2, 15.4.2, 15.5.2, and 15.6.2). An asterisk dummy argument indicates that the corresponding actual argument is an alternate return specifier ( 15.6.2.3, 15.8.3, and 15.9.3.5).

Each dummy argument name that is classified as a variable, array, or dummy procedure may appear wherever an actual name of the same class (Section 18) and type may appear, except where explicitly prohibited.

## 2.9 Scope of Symbolic Names and Statement Labels

The scope of a symbolic name ( 18.1) 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.

Statement labels have a scope of a program unit.

## 2.10 List

A list is a nonempty sequence ( 2.1) of syntactic entities separated by commas. The entities in the list are called list items.

## 2.11 Definition Status

At any gi ven time during the execution of an executable program, the definition status of each variable, array element, or substring is either defined or undefined (Section 17).

A defined entity has a value. The value of a defined !entity does not change until the entity becomes undefined or is redefined with a different value.

If a variable, array element, or substring is undefined, it does not have a predictable value.

A previously defined variable or array element may become undefined. Subsequent definition of a defined variable or array element is permitted, except where it is explicitly prohibited.

A character variable, character array element, or character substring is defined if every substring of length one of the entity is defined. Note that if a string is defined, every substring of the string is defined, and if any substring of the string is undefined, the string is undefined. Defining any substring does not cause any other string or substring to become undefined.

An entity is initially defined if it is assigned a value in a DATA statement (Section 9). Initially defined entities are in the defined state at the beginning of execution of an executable program. All variables and array elements not initially defined, or associated ( 2.14) with an initially defined entity, are undefined at the beginning of execution of an executable program.

An entity must be defined at the time a reference to it is executed.

## 2.12 Reference

A variable, array element, or substring reference is the appearance of a variable, array element, or substring name, respectively, in a statement in a context requiring the value of that entity to be used during the execution of the executable program. When a reference to an entity is executed, its current value is available. In this standard, the act of defining an entity is not considered a reference to that entity.

A procedure reference is the appearance of a procedure name in a statement in a context that requires the actions specified by the procedure to be executed during the execution of the executable program. When a procedure reference is executed, the procedure must be available.

## 2.13 Storage

A storage sequence is a sequence of storage units. A storage unit is either a numeric storage unit or a character storage unit.

An integer, real, or logical datum has one numeric storage unit in a storage sequence. A double precision or complex datum has two numeric storage units in a storage sequence. A character datum has one character storage unit in a storage sequence for each character in the datum. This standard does not specify a relationship between a numeric storage unit and a character storage unit.

If a datum requires more than one storage unit in a storage sequence, those storage units are consecutive.

The concept of a storage sequence is used to describe relationships that exist among variables, array elements, arrays, substrings, and common blocks. This standard does not specify a relationship between the storage sequence concept and the physical properties or implementation of storage.

## 2.14 Association

Association of entities exists if the same datum may be identified by different symbolic names in the same program unit, or by the same name or a different name in different program units of the same executable program ( 17.1).

Entities may become associated by the following:

1. Common association ( 8.3.4)
2. Equivalence association ( 8.2.2)
3. Argument association ( 15.9.3)
4. Entry association ( 15.7.3)

[Contents] [Previous] [Next] [Home]

NDP77
http://www.ndp77.net
webmaster MFA (main)
webmaster@ndp77.net