The general form of record assignment is: @
v = e |
|
e |
A record or record field |
v |
A record or record field |
Both e and v must have the same structure. That is, each must have the same number of fields, and corresponding fields must be of the same type and size.
Example: A record assignment and a record-field assignment:
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 = NEXT LINE(1) = CURRENT WRITE ( 9 ) CURRENT NEXT.ID = 82
In the above example, the first assignment statement copies one whole record (all five fields) to another record; the second assignment statement copies a whole record into the first element of an array of records; the WRITE statement writes a whole record; and the last statement sets the ID of one record to 82.