An aggregate reference resolves into a reference to a structured data item (a record structure or substructure). For example:Data Declarations:
STRUCTURE /STRA/ INTEGER INTFLD, INTFLDARY (10) END STRUCTURE . . . STRUCTURE /STRB/ CHARACTER*20 CHARFLD INTEGER INTFLD, INTFLDARY (10) STRUCTURE STRUCFLD COMPLEX CPXFLD, CPXFLDARY (10) END STRUCTURE RECORD /STRA/ RECFLD, RECFLDARY (10) END STRUCTURE . . . RECORD /STRB/ REC, RECARY (10)
Reference Examples:
REC --- A record name RECARY(1) --- A record array reference REC.RECFLD --- A reference to a substructure REC.RECFLDARY(1) --- A reference to a substructure array element RECARY(1).RECFLD --- A reference to a substructure in a record array element RECARY(1).RECFLDARY(1) --- A reference to a substructure array element in a record array
An array is a group of contiguous storage locations associated with a single symbolic name, the array name. The individual storage locations, called array elements, are referred to by a subscript appended to the array name. An array can have from 1 to 7 dimensions. The Fortran statements that establish arrays are: type declaration statements, the DIMENSION statement, and the COMMON statement.The data type of an array is specified in the same way as the data type of a variable; either implicitly by the first letter of the name or explicitly by a type declaration statement.
An array name reference resolves into the name of an array with no subscripts after the array name. For example:Data Declarations:
INTEGER INT, INTARY (10) . . . STRUCTURE /STRA/ INTEGER INTFLD, INTFLDARY (10) END STRUCTURE . . . STRUCTURE /STRB/ CHARACTER*20 CHARFLD INTEGER INTFLD, INTFLDARY (10) STRUCTURE STRUCFLD COMPLEX CPXFLD, CPXFLDARY (10) END STRUCTURE RECORD /STRA/ RECFLD, RECFLDARY (10) END STRUCTURE . . . RECORD /STRB/ REC, RECARY (10)
Reference Examples:
INTARY --- Numeric or character array RECARY --- Array of records REC.INTFLDARY --- Numeric or character array field of a record REC.RECFLDARY --- Array of substructures within a record RECARY(1).INTFLDARY --- Numeric or character array field of a record array element RECARY(1).RECFLDARY --- Array of substructures within a record array element
A constant is a fixed value. The value of a constant can be a numeric value, a logical value, or a character string. There are seven types of constants: integer, real, complex, bit, logical, character, and Hollerith. Bit and Hollerith constants have no data type; they assume a data type that conforms to the context in which they are used.
An expression represents a single value. An expression can consist of a single constant, variable, record element, array element, or function reference; or combinations of these data items plus certain other elements, called operators. Operators specify computations to be performed on the values of the data items and a single result is obtained.Expressions are classified as arithmetic, character, relational, or logical. Arithmetic expressions produce numeric values; character expressions produce character values; and relational and logical expressions produce logical values.
The data components of an expression must be compatible and must be joined by compatible operators. Expressions are evaluated one operator at a time according to the rules of precedence. The ranking assigned to each data type is as follows:
Data Type Ranking --------- ------- BYTE 1 (lowest) LOGICAL*1 1 LOGICAL*2 2 LOGICAL*4 3 LOGICAL*8 (AXP only) 4 INTEGER*1 5 INTEGER*2 6 INTEGER*4 7 INTEGER*8 (AXP only) 8 REAL (REAL*4) 9 DOUBLE PRECISION (REAL*8) 10 COMPLEX (COMPLEX*8) 11 DOUBLE COMPLEX (COMPLEX*16) 12 (highest)
A record is a named data entity, consisting of one or more fields, which you can use when you need to declare and operate on multi-field data structures in your programs.To create a record, you must have a structure declaration (to describe the fields in the record) and a RECORD statement to establish the record in memory.
A scalar reference is a scalar variable, scalar record field, array element, constant, character substring, or expression that resolves into a single, typed data item. For example:Data Declarations:
INTEGER INT, INTARY (10) . . . STRUCTURE /STRA/ INTEGER INTFLD, INTFLDARY (10) END STRUCTURE . . . STRUCTURE /STRB/ CHARACTER*20 CHARFLD INTEGER INTFLD, INTFLDARY (10) STRUCTURE STRUCFLD COMPLEX CPXFLD, CPXFLDARY (10) END STRUCTURE RECORD /STRA/ RECFLD, RECFLDARY (10) END STRUCTURE . . . RECORD /STRB/ REC, RECARY (10)
Reference Examples:
INT --- Numeric variable INTARY(1) --- Numeric array element REC.INTFLD --- Numeric field REC.INTFLDARY(1) --- Numeric element of an array field CHARVAR(5:10) --- Substring expression of a character variable REC.CHARFLD(5:10) --- Substring expression of a character field
Note: A scalar memory reference is the same as a scalar reference, excluding constants, character substrings, and expressions.
A character substring is a contiguous segment of a character variable, character array element, or character field reference. It has one of the following forms:v([e1]:[e2]) OR a(s[,s]...)([e1]:[e2])
v Is a character variable name a Is a character array name s Is a subscript expression e1 Is a numeric expression specifying the leftmost character position of the substring e2 Is a numeric expression specifying the rightmost character position of the substring NOTE: 1 .LE. e1 .LE. e2 .LE. length-of-v must hold true
The Fortran data types are as follows:o Integer - a whole number
o REAL (REAL*4) - a single-precision floating point number (a whole number or a decimal fraction or a combination)
o DOUBLE PRECISION (REAL*8) - a double-precision floating point number (like REAL*4, but with twice the degree of accuracy in its representation)
o COMPLEX (COMPLEX*8) - a pair of REAL*4 values representing a complex number (the first part of the number is the real part, the second is the imaginary part)
o COMPLEX*16 (DOUBLE COMPLEX) - like complex, but with twice the degree of accuracy in its representation (its real or imaginary part must be a REAL*8)
o Logical - a logical value, .TRUE. or .FALSE.
o Character - a sequence of characters
o BYTE - equivalent to INTEGER*1
A variable is represented by a symbolic name which is associated with a storage location. The value of the variable is the value currently stored in that location; the value can be changed by assigning a new value to the variable.Variables, like constants, are classified by data type. When data of any type is assigned to a variable, it is converted, if necessary, to the data type of the variable. You can establish the data type of a variable by type declaration statements, IMPLICIT statements, or predefined typing rules.