! 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 9.2. Control list examples.
  program J02
    implicit none
    real, parameter :: A = 1.5, C = 2.6
    real :: Y
    integer, parameter :: B = 99
    integer :: Code, X, Z
! start program J02
    open (unit = 1, file = "controls.txt", status = "old", action = "read", position = "rewind")
    open (unit = 2, file = "j02.zzz", status = "new", action = "write")
    write (unit = 2, fmt = "(f10.3, i6, f10.3, A)", advance = "NO") A, B, C, " # "
    read (unit = 1, fmt = *, iostat = Code) X, Y, Z
    write (unit = 2, fmt = *) Code, X + Y + Z
    stop
  end program J02
