! 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.9. (File input and output.) Mixed scalar and whole-array expressions.
  program F09
    implicit none
    real, dimension(5, 7) :: A, B, D, E
    logical, dimension(5, 7) :: T
! start program F09
    D = 0.0
    E = 1.0
    open (unit = 1, file = "myinput.txt", status = "old", action = "read", position = "rewind")
    open (unit = 2, file = "f09.zzz", status = "new", action = "write")
    read (unit = 1, fmt = *) B
    A = 2.0 * B
    T = (B /= 0.0) .and. (A > 2.0)
    write (unit = 2, fmt = *) " A: ", A
    write (unit = 2, fmt = *) " D: ", D
    write (unit = 2, fmt = *) " E: ", E
    write (unit = 2, fmt = *) " T: ", T
    stop
  end program F09
