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 --- Is a record name.
RECARY(1) --- Is a record array reference.
REC.RECFLD --- Is a reference to a substructure.
REC.RECFLDARY(1) --- Is a reference to a substructure array element.
RECARY(1).RECFLD --- Is a reference to a substructure in a record array element.
RECARY(1).RECFLDARY(1) --- Is a reference to a substructure
array element in a record array.
Arrays
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.
Additional Information on:
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 --- Is a numeric or character array.
RECARY --- Is an array of records.
REC.INTFLDARY --- Is a numeric or character array field of a record.
REC.RECFLDARY --- Is an array of substructures within a record.
RECARY(1).INTFLDARY --- Is a numeric or character array field of a record array element.
RECARY(1).RECFLDARY --- Is an array of substructures within a
record array element.
Constants
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.
Additional Information on:
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, LOGICAL*1, INTEGER*1 1 (lowest) LOGICAL*2 2 LOGICAL*4 3 INTEGER*2 4 INTEGER*4 5 REAL*4 (REAL) 6 REAL*8 (DOUBLE PRECISION) 7 REAL*16 8 COMPLEX*8 (COMPLEX) 9 COMPLEX*16 (DOUBLE COMPLEX) 10 (highest)
Additional Information on:
Additional Information on:
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 --- Is a numeric variable.
INTARY(1) --- Is a numeric array element.
REC.INTFLD --- Is a numeric field.
REC.INTFLDARY(1) --- Is a numeric element of an array field.
CHARVAR(5:10) --- Is a substring expression of a character variable.
REC.CHARFLD(5:10) --- Is a substring expression of a character field.
Note: A scalar memory reference is the same as a scalar reference,
excluding constants and expressions.
Substrings
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
Types
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 REAL*16 - A quad-precision floating-point number (like REAL*4, but with four times 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) - Similar to 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
Additional Information on:
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.
Additional Information on: