FORTRAN 77 Language Reference

RECORD

The RECORD @ statement defines variables to have a specified structure, or arrays to be arrays of variables with such structures.

RECORD /struct-name/ record-list [,/struct-name/ record-list]...

Parameter 

Description 

struct_name

Name of a previously declared structure  

record_list

List of variables, arrays, or array declarators 

Description

A structure is a template for a record. The name of the structure is included in the STRUCTURE statement, and once a structure is thus defined and named, it can be used in a RECORD statement.

The record is a generalization of the variable or array: where a variable or array has a type, the record has a structure. Where all the elements of an array must be of the same type, the fields of a record can be of different types.

The RECORD line is part of an inherently multiline group of statements, and neither the RECORD line nor the END RECORD line has any indication of continuation. Do not put a nonblank in column six, nor an & in column one.

Structures, fields, and records are discussed in "Structures".

Restrictions

Example

Example 1: Declare some items to be records of a specified structure:


       STRUCTURE /PRODUCT/ 
             INTEGER*4 ID 
             CHARACTER*16 NAME 
             CHARACTER*8 MODEL 
             REAL*4 COST 
             REAL*4 PRICE 
       END STRUCTURE 
       RECORD /PRODUCT/ CURRENT, PRIOR, NEXT, LINE(10)
       ...

Each of the three variables CURRENT, PRIOR, and NEXT is a record which has the PRODUCT structure, and LINE is an array of 10 such records.

Example 2: Define some fields of records, then use them:


       STRUCTURE /PRODUCT/
              INTEGER*4    ID
              CHARACTER*16 NAME
              CHARACTER*8  MODEL
              REAL*4       COST
              REAL*4       PRICE
       END STRUCTURE
       RECORD /PRODUCT/  CURRENT, PRIOR, NEXT, LINE(10)
       CURRENT.ID = 82
       PRIOR.NAME = "CacheBoard"
       NEXT.PRICE = 1000.00
       LINE(2).MODEL = "96K"
       PRINT 1, CURRENT.ID, PRIOR.NAME, NEXT.PRICE,LINE(2).MODEL
1      FORMAT(1X I5/1X A16/1X F8.2/1X A8)
       END

The above program produces the following output:


82
CacheBoard
1000.00
96K