# 17 ASSOCIATION AND DEFINITION

## 17.1 Storage and Association

Storage sequences are used to describe relationships that exist among variables, array elements, substrings, common blocks, and arguments.

### 17.1.1 Storage Sequence.

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).

### 17.1.2 Association of Storage Sequences.

Two storage sequences s 1 and s 2 are associated if the ith storage unit of s 1 is the same as the jth storage unit of s 2 . This causes the (i+k)th storage unit of s 1 to be the same as the (j+k)th storage unit of s 2 , for each integer k such that 1 <= i+k <= size of s 1 and 1 <= j+k <= size of s 2 .

### 17.1.3 Association of Entities.

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:

1. REAL A(4)a,B
2. COMPLEX C(2)
3. DOUBLE PRECISION D
4. 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  |
|  ----C(1)----|  ----C(2)----|
|  A(1)|  A(2)    A(3)|  A(4)|
|  --B--|
|  -----D----- |
```

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:

1. CHARACTER A*4,B*4,C*3
2. EQUIVALENCE (A(2:3),B,C)

A, B, and C are partially associated.

## 17.2 Events That Cause Entities to Become Defined

Variables, array elements, and substrings become defined as follows:
1. Execution of an arithmetic, logical, or character assignment statement causes the entity that precedes the equals to become defined.
2. 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.
3. Execution of a DO statement causes the DO-variable to become defined.
4. Beginning of execution of action specified by an implied-DO list in an input/output statement causes the implied-DO-variable to become defined.
5. A DATA statement causes entities to become initially defined at the beginning of execution of an executable program.
6. Execution of an ASSIGN statement causes the variable in the statement to become defined with a statement label value.
7. 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.
8. 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).
9. Execution of an input/output statement containing an input/output status specifier causes the specified integer variable or array element to become defined.
10. 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.
11. When a complex entity becomes defined, all partially associated real entities become defined.
12. 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.
13. When all characters of a character entity become defined, the character entity becomes defined.

## 17.3 Events That Caused Entities to Become Undefined

Variables, array elements, and substrings become undefined as follows:
1. All entities are undefined at the beginning of execution of an executable program except those entities initially defined by DATA statements.
2. When an entity of a given type becomes defined, all totally associated entities of different type become undefined.
3. 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.
4. 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.
5. 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).
6. 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:
1. Entities in blank common
2. Initially defined entities that have neither been redefined nor become undefined
3. Entities specified by SAVE statements
4. 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
7. 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.
8. 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.
9. Execution of an INQUIRE statement may cause entities to become undefined ( 12.10.3).
10. When any character of a character entity becomes undefined, the character entity becomes undefined.
11. 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.

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

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