FORTRAN 77 Language Reference

Record and Field Reference

You can refer to a whole record, or to an individual field in a record, and since structures can be nested, a field can itself be a structure, so you can refer to fields within fields, within fields, and so forth.

The syntax of record and field reference is:

record-name[.field-name] ... [.field-name]

record-name

Name of a previously defined record variable 

field-name

Name of a field in the record immediately to the left.  

Example: References that are based on structure and records of the above two examples:


	...
	RECORD /PRODUCT/ CURRENT, PRIOR, NEXT, LINE(10) 
	... 
	CURRENT = NEXT 
	LINE(1) = CURRENT
	WRITE ( 9 ) CURRENT 
	NEXT.ID = 82

In the above example:

Example: Structure and record declarations, record and field assignments:


demo% cat str1.f
* str1.f Simple structure 
	STRUCTURE / S / 
		INTEGER*4 I 
		REAL*4 R 
	END STRUCTURE 
	RECORD / S / R1, R2 
	R1.I = 82 
	R1.R = 2.7182818 
	R2 = R1 
	WRITE ( *, * ) R2.I, R2.R 
	STOP 
	END 
demo% f77 -silent str1.f
demo% a.out
82 2.718280 
demo%