!!----------------------------------------------------------------------------
!! $Id: read_data.f90,v 1.3 1997/11/12 02:03:48 svmcguir Exp $
!! subroutine read_data:
!!    This subroutine will read in data from the old MC program, this
!!    will have the payoffs
!!    Author: Scott A. Klasky
!!    Date  : 10/19/97
!!----------------------------------------------------------------------------
subroutine read_data(fname1,fname2,max_params,params,stockprice1,stockprice2)
  use PATHS
  use input_params
  implicit none
  integer,intent(IN)                       :: max_params
  real*8,dimension(max_params),intent(IN)  :: params
  real*8,dimension(:,:),intent(OUT)        :: stockprice1,stockprice2
  character*(*),intent(IN)                 :: fname1,fname2

  integer                                  :: i,j
  integer                                  :: iter

  open(20,file=fname1)
  open(21,file=fname2)

  do j = 1 , int(params(P_NPATH))
     read(20,*) iter
     do i = 1, int(params(P_NTIME))
        read(20,*) stockprice1(i,j)
        read(21,*) stockprice2(i,j)
     end do !i
  end do !j

  close(20)
  close(21)

  return
end subroutine read_data
