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 |
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".
Each record is allocated separately in memory.
Initially, records have undefined values.
Records, record fields, record arrays, and record-array elements are allowed as arguments and dummy arguments. When you pass records as arguments, their fields must match in type, order, and dimension. The record declarations in the calling and called procedures must match.
Within a union declaration, the order of the map fields is not relevant.
Record fields are not allowed in COMMON statements.
Records and record fields are not allowed in DATA, EQUIVALENCE, NAMELIST, PARAMETER, AUTOMATIC, STATIC, or SAVE statements. To initialize records and record fields, use the STRUCTURE statement. See "STRUCTURE" for more information.
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