! 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.18. (Fortran 90 version.) Find and insert with MinLoc.
  program F18
    use F18M
    implicit none
    integer, parameter :: ARRAY_SIZE = 20
    real, dimension(ARRAY_SIZE) :: Data_Array
    real :: X
    integer :: Loop, EoF, Current_Size
! start program F18
    open (unit = 1, file = "ordvec.txt", status = "old", action = "read",  position = "rewind" )
    do Loop = 1, ARRAY_SIZE
      read (unit = 1, fmt = *, iostat = EoF) Data_Array(Loop)
      if (EoF < 0) then
        exit
      end if
    end do
    Current_Size = Loop - 1
    read (unit = *, fmt = *) X
    call Find( Data_Array, X, Current_Size )
    stop
  end program F18

