B.12.4 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 demonstrates 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


Previous Page Next Page Table of Contents