An array name not qualified by a subscript identifies the entire sequence of elements of the array in certain forms where such use is permitted ( 5.6); however, in an EQUIVALENCE statement, an array name not qualified by a subscript identifies the first element of the array ( 8.2.4).
An array element name identifies one element of the sequence. The subscript value (Table 1) specifies the element of the array being identified. A different array element may be identified by changing the subscript value of the array element name.
An array name is local to a program unit ( 18.1.2).
A substring is a contiguous portion of a character datum.
a (d [,d]...)
The number of dimensions of the array is the number of dimension declarators in the array declarator. The minimum number of dimensions is one and the maximum is seven.
[d :] d 1 2
The lower and upper dimension bounds are arithmetic expressions, called dimension bound expressions, in which all constants, symbolic names of constants, and variables are of type integer. The upper dimension bound of the last dimension may be an asterisk in assumed-size array declarators ( 5.1.2). A dimension bound expression must not contain a function or array element reference. Integer variables may appear in dimension bound expressions only in adjustable array declarators ( 5.1.2).
If the symbolic name of a constant or variable that appears in a dimension bound expression is not of default implied integer type ( 4.1.2), it must be specified as integer by an IMPLICIT statement or a type-statement prior to its appearance in a dimension bound expression.
Each array declarator is either an actual array declarator or a dummy array declarator.
The properties of an array in a program unit are specified by the array declarator for the array in that program unit.
The size of a dimension is the value:
d - d + 1 2 1
Note that if the value of the lower dimension bound is one, the size of the dimension is d 2 .
The size of a dimension whose upper bound is an asterisk is not specified.
The number and size of dimensions in one array declarator may be different from the number and size of dimensions in another array declarator that is associated by common, equivalence, or argument association.
If an assumed-size dummy array has n dimensions, the product of the sizes of the first n - 1 dimensions must be less than or equal to the size of the array, as determined by one of the immediately preceding rules.
Whenever an array name unqualified by a subscript is used to designate the whole array ( 5.6), the appearance of the array name implies that the number of values to be processed is equal to the number of elements in the array and that the elements of the array are to be taken in sequential order.
a (s [,s]...)
The number of subscript expressions must be equal to the number of dimensions in the array declarator for the array name.
(s [,s]...)where s is a subscript expression.
Note that the term "subscript" includes the parentheses that delimit the list of subscript expressions.
Within a program unit, the value of each subscript expression must be greater than or equal to the corresponding lower dimension bound in the array declarator for the array. The value of each subscript expression must not exceed the corresponding upper dimension bound declared for the array in the program unit. If the upper dimension bound is an asterisk, the value of the corresponding subscript expression must be such that the subscript value does not exceed the size of the dummy array.
____________________________________________________________ | | | | | |n | Dimension | Subscript | Subscript | | | Declarator | | Value | |__|______________________|______________|_________________| | | | | | |1 | (j :k ) | (s ) | 1+(s -j ) | | | 1 1 | 1 | 1 1 | |__|______________________|______________|_________________| | | | | | |2 | (j1:k1,j2:k2) | (s1,s2) | 1+(s1-j1) | | | | | +(s2-j2)*d1 | |__|______________________|______________|_________________| | | | | | |3 | (j :k ,j :k ,j :k ) | (s ,s ,s ) | 1+(s -j ) | | | 1 1 2 2 3 3 | 1 2 3 | +(s1-j1)*d | | | | | +(s2-j2)*d1*d | | | | | 3 3 2 1 | |__|______________________|______________|_________________| | | | | | |__|______________________|______________|_________________| | | | | | |n | (j :k ,...,j :k ) | (s ,...,s ) | 1+(s -j ) | | | 1 1 n n | 1 n | +(s1-j1)*d | | | | | +(s2-j2)*d1*d | | | | | +..3 3 2 1 | | | | | +(s -j )*d | | | | | *dn n...n-1 | | | | | n-2 1 | |__|______________________|______________|_________________|
Notes for Table 1:
Note that a subscript of the form (j ,...j ) 1 n has a subscript value of one and identifies the first element of the array. A subscript of the form (k ,...,k ) 1 n identifies the last element of the array; its subscript value is equal to the number of elements in the array.
The subscript value and the subscript expression value are not necessarily the same, even for a one-dimensional array. In the example:
A(2) identifies the fourth element of A, the subscript is (2) with a subscript value of four, and the subscript expression is 2 with a value of two. B(1,2) identifies the eleventh element of B, the subscript is (1,2) with a subscript value of eleven, and the subscript expressions are 1 and 2 with values of one and two.
An actual array is an array for which the array declarator is an actual array declarator. Each array in the main program is an actual array and must have a constant array declarator. A dummy array may be used as an actual argument.
An adjustable array declarator must be a dummy array declarator. At least one dummy argument list of the subprogram must contain the name of the adjustable array. A variable name that appears in a dimension bound expression of an array must also appear as a name either in every dummy argument list that contains the array name or in a common block in that subprogram.
At the time of execution of a reference to a function or subroutine containing an adjustable array in its dummy argument list, each actual argument that corresponds to a dummy argument appearing in a dimension bound expression for the array and each variable in common appearing in a dimension bound expression for the array must be defined with an integer value. The values of those dummy arguments or variables in common, together with any constants and symbolic names of constants appearing in the dimension bound expression, determine the size of the corresponding adjustable dimension for the execution of the subprogram. The sizes of the adjustable dimensions and of any constant dimensions appearing in an adjustable array declarator determine the number of elements in the array and the array element ordering. The execution of different references to a subprogram or different executions of the same reference determine possibly different properties (size of dimensions, dimension bounds, number of elements, and array element ordering) for each adjustable array in the subprogram. These properties depend on the values of any actual arguments and variables in common that are referenced in the adjustable dimension expressions in the subprogram.
During the execution of an external procedure in a subprogram containing an adjustable array, the array properties of dimension size, lower and upper dimension bounds, and array size (number of elements in the array) do not change. However, the variables involved in an adjustable dimension may be redefined or become undefined during execution of the external procedure with no effect on the above-mentioned properties.
v ( [e ] : [e ] ) 1 2
a (s [,s]...)( [e ] : [e ] ) 1 2
The value e 1 specifies the leftmost character position of the substring, and the value e 2 specifies the rightmost character position. For example, A(2:4) specifies characters in positions two through four of the character variable A, and B(4,3)(1:6) specifies characters in positions one through six of the character array element B(4,3).
The values of e 1 and e 2 must be such that:
1 <= e <= e <= len 1 2
where len is the length of the character variable or array element ( 8.4.2). If e 1 is omitted, a value of one is implied for e 1 . If e 2 is omitted, a value of len is implied for e 2 . Both e and e 1 2 may be omitted; for example, the form v(:) is equivalent to v , and the form a(s [,s]...)(:) is equivalent to a(s [,s]...) . The length of a character substring is e - e + 1 2 1 .
webmaster MFA (main)