! 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 6.19. Structures - Survey example.
  program G19
    use G19M
    implicit none
    type (Station), allocatable, dimension(:) :: Traverse  ! Table of structures
    type (Station) :: Bench_Mark
    integer :: Loop, N_Stations
! start program G19
    open (unit = 1, file = "g19.txt", status = "old", action = "read", position = "rewind")
    read (unit = 1, fmt = *) N_Stations
    allocate( Traverse(N_Stations) )
    do Loop = 1, N_Stations
      read (unit = 1, fmt = *) Traverse(Loop)  ! Read all components of one structure.
    end do
    Bench_Mark = Traverse(1)  ! Whole-structure assignment
    write (unit = *, fmt = *) Bench_Mark  ! Print all components
    stop
  end program G19
