Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

Aggregate Assignment

For aggregate assignment statements, the variable and expression must have the same structure as the aggregate they reference.

The aggregate assignment statement assigns the value of each field of the aggregate on the right of an equal sign to the corresponding field of the aggregate on the left. Both aggregates must be declared with the same structure.

Examples

The following example shows valid aggregate assignments:

 STRUCTURE /DATE/
   INTEGER*1 DAY, MONTH
   INTEGER*2 YEAR
 END STRUCTURE

 RECORD /DATE/ TODAY, THIS_WEEK(7)
 STRUCTURE /APPOINTMENT/
   ...
   RECORD /DATE/ APP_DATE
 END STRUCTURE

 RECORD /APPOINTMENT/ MEETING

 DO I =  1,7
   CALL GET_DATE (TODAY)
   THIS_WEEK(I) =     TODAY
   THIS_WEEK(I).DAY = TODAY.DAY + 1
 END DO
 MEETING.APP_DATE =   TODAY