Storage sequences are used to describe relationships that exist among variables, array elements, substrings, common blocks, and arguments.
A storage sequence is a sequence (2.1) of storage units. The size of a storage sequence
is the number of storage units in the storage sequence. A storage unit is a character storage unit or a numeric storage unit.
A variable or array element of type integer, real, or logical has a storage sequence of one numeric storage unit.
A variable or array element of type double precision or complex has a storage sequence of two numeric storage units. In a complex storage sequence, the real part has the first storage unit and the imaginary part has the second storage unit.
A variable, array element, or substring of type character has a storage sequence of character storage units. The number of character storage units in the storage sequence is the length of the character entity. The order of the sequence corresponds to the ordering of character positions (4.8).
Each array and common block has a storage sequence (5.2.5 and 8.3.2).
Two storage sequences s1 and s2 are
associated if the ith storage unit of s1 is the same as the jth storage unit of s2. This causes the (i+k)th storage unit of s1 to be the same as the (j+k)th storage unit of s2, for each integer k such that 1 <= i+k <= size of s1 and 1 <= j+k <= size of s2.
Two variables, array elements, or substrings are associated if their storage sequences are associated. Two entities are totally associated if they have the same storage sequence. Two entities are partially associated if they are associated but not totally associated.
The definition status and value of an entity affects the definition status and value of any associated entity. An EQUIVALENCE statement, a COMMON statement, an ENTRY statement(15.7.3), or a procedure reference (argument association) may cause association of storage sequences.
An EQUIVALENCE statement causes association of entities only within one program unit, unless one of the equivalenced entities is also in a common block (8.3).
Arguments and COMMON statements cause entities in one program unit to become associated with entities in another program unit (8.3 and 15.9). Note that association between actual and dummy arguments does not imply association of storage sequences except when the actual argument is the name of a variable, array element, array, or substring.
In a function subprogram, an ENTRY statement causes the entry name to become associated with the name of the function subprogram which appears in the FUNCTION statement.
Partial association may exist only between two character entities or between a double precision or complex entity and an entity of type integer, real, logical, double precision, or complex.
Except for character entities, partial association may occur only through the use of COMMON, EQUIVALENCE, or ENTRY statements. Partial association must not occur through argument association, except for arguments of type character.
In the example:
DOUBLE PRECISION D
EQUIVALENCE (C(2),A(2),B), (A,D)
the third storage unit of C, the second storage unit of A, the storage unit of B, and the second storage unit of D are specified as the same. The storage sequences may be illustrated as:
storage unit | 1 | 2 | 3 | 4 | 5 |
| A(1) | A(2) | A(3) | A(4) |
A(2) and B are totally associated. The following are partially associated: A(1) and C(1), A(2) and C(2), A(3) and C(2), B and C(2), A(1) and D, A(2) and D, B and D, C(1) and D, and C(2) and D. Note that although C(1) and C(2) are each associated with D, C(1) and C(2) are not associated with each other.
Partial association of character entities occurs when some, but not all, of the storage units of the entities are the same. In the example:
A, B, and C are partially associated.
Variables, array elements, and substrings become defined as follows:
Variables, array elements, and substrings become undefined as follows:
- Execution of an arithmetic, logical, or character assignment statement causes the entity that precedes the equals to become defined.
- As execution of an input statement proceeds, each entity that is assigned a value of its corresponding type from the input medium becomes defined at the time of such assignment.
- Execution of a DO statement causes the DO-variable to become defined.
- Beginning of execution of action specified by an implied-DO list in an input/output statement causes the implied-DO-variable to become defined.
- A DATA statement causes entities to become initially defined at the beginning of execution of an executable program.
- Execution of an ASSIGN statement causes the variable in the statement to become defined with a statement label value.
- When an entity of a given type becomes defined, all totally associated entities of the same type become defined except that entities totally associated with the variable in an ASSIGN statement become undefined when the ASSIGN statement is executed.
- A reference to a subprogram causes a dummy argument to become defined if the corresponding actual argument is defined with a value that is not a statement label value. Note that there must be agreement between the actual argument and the dummy argument (15.9.3).
- Execution of an input/output statement containing an input/output status specifier causes the specified integer variable or array element
to become defined.
- Execution of an INQUIRE statement causes any entity that is assigned a value during the execution of the statement to become defined if no error condition exists.
- When a complex entity becomes defined, all partially associated real entities become defined.
- When both parts of a complex entity become defined as a result of partially associated real or complex entities becoming defined, the complex entity becomes defined.
- When all characters of a character entity become defined, the character entity becomes defined.
- All entities are undefined at the beginning of execution of an executable program except those entities initially defined by DATA statements.
- When an entity of a given type becomes defined, all totally associated entities of different type become undefined.
- Execution of an ASSIGN statement causes the variable in the statement to become undefined as an integer. Entities that are associated with the variable become undefined.
- When an entity of type other than character becomes defined, all partially associated entities become undefined. However, when an entity of type real is partially associated with an entity of type complex, the complex entity does not become undefined when the real entity becomes defined and the real entity does not become undefined when the complex
entity becomes defined. When an entity of type complex is partially associated with another entity of type complex, definition of one entity does not cause the other to become undefined.
- When the evaluation of a function causes an argument of the function or an entity in common to become defined and if a reference to the function appears in an expression in which the value of the function is not needed to determine the value of the expression, then the argument or the entity in common becomes undefined when the expression is evaluated (6.6.1).
- The execution of a RETURN statement or an END statement within a subprogram causes all entities within the subprogram to become undefined except for the following:
- Entities in blank common
- Initially defined entities that have neither been redefined nor become undefined
- Entities specified by SAVE statements
- Entities in a named common block that appears in the subprogram and appears in at least one other program unit that is either directly or indirectly referencing the subprogram
- When an error condition or end-of-file condition occurs during execution of an input statement, all of the entities specified by the input list of the statement become undefined.
- Execution of a direct access input statement that specifies a record that has not been previously written causes all of the entities specified by the input list of the statement to become undefined.
- Execution of an INQUIRE statement may cause entities to become undefined (12.10.3).
- When any character of a character entity becomes undefined, the character entity becomes undefined.
- When an entity becomes undefined as a result of conditions described in (5) through (10), all totally associated entities become undefined and all partially associated entities of type other than character become undefined.
This document was translated by troff2html v0.21 on August 16, 1995.