! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 5.7. (File input and output.) Whole-array assignment.
  program F07
    implicit none
    real, dimension(5, 7) :: A, B
    real, dimension(0: 4, 0: 6) :: C
    integer, dimension(5, 7) :: I
! start program F07
    open (unit = 1, file = "f07in.txt", status = "old", action = "read", position = "rewind")
    open (unit = 2, file = "f07.zzz", status = "new", action = "write")
    read (unit = 1, fmt = *) B
    C = B
    I = C  ! Type coercion, with truncation, occurs.
    A = I
    write (unit = 2, fmt = *) A
    stop
  end program F07
