! 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.8. (File input and output.) Arithmetic and relational operations on whole arrays.
  program F08
    implicit none
    real, dimension(5, 7) :: A, B, C
    logical, dimension(5, 7) :: T
    real, dimension(20) :: V, V_Squared
! start program F08
    open (unit = 7, file = "myinput.txt", status = "old", action = "read", position = "rewind")
    open (unit = 2,  file = "f08.zzz", status = "new", action = "write")
    read (unit = 7, fmt = *) B, C, V
    A = B + C
    T = B > C
    C = A * B
    V_Squared = V * V
    write (unit = 2, fmt = *) T
    write (unit = 2, fmt = *) C
    write (unit = 2, fmt = *) V
    write (unit = 2, fmt = *) V_Squared
    stop
  end program F08
