FORTRAN Reference Manual
Language Elements
FORTRAN Reference Manual—528615-001
2-20
Records
last
specifies the position of the last character in the substring
For example, if you store the string ABRACADABRA in the variable PASSWORD, the 
substring
password (3:6)
refers to the characters RACA.
If you omit first, the substring begins with the first character in var-name. If you omit 
last, the substring ends with the last character in var-name. For example:
password (:5)
refers to the characters ABRAC;
password (7:)
refers to the characters DABRA.
You can reference a substring of an array element in a character array by specifying 
the array element, followed by the substring reference. For example, if the fifth element 
of the array GAMES(100) contains the string HANGMAN, the following substring 
reference contains the characters HANG.
games(5)(1:4)
Records
The RECORD declaration statement is a HP extension that enables you to declare 
structured data. Unlike arrays, the elements of RECORDs can be different types. The 
following is an example of a RECORD declaration:
RECORD addresses <-- addresses is the RECORD name
 FILLER*5
 CHARACTER*10 lastname <-- data type declaration
 CHARACTER*10 firstname (RECORD field name)
 CHARACTER*1 middle
 FILLER*2 <-- FILLER declaration
 CHARACTER*20 street
 CHARACTER*10 city
 CHARACTER*2 state
 CHARACTER*9 zip
END RECORD
Records defined in RECORD declaration statements are called RECORDs. The 
individual elements of a record are called RECORD fields.










