      subroutine DATA_INPUT(funitRes,pTrunc,nTrunc,np,aod,bod,theta0,
     +                      kdStart,kdStep,nkdPts)

c**********************************************************************
c**** Reads in data from datafiles                                 ****
c****                                                              ****
c**** Written 14/11/2021                                           ****
c**********************************************************************
c                                                     column 72 here -->
      implicit none
      include 'trunc.h'

      character*80     fnameInp,fnameRes,dummyChar

      integer          funitInp,funitRes
      integer          ind,LEN_TO_CHAR
      integer          pTrunc,nTrunc,np,nkdPts

      double precision kdStart,kdStep
      double precision aod,bod,theta0

c**********************************************************************
c**** Define the file unit numbers to be used                      ****
c**********************************************************************

      funitInp = 10

c**********************************************************************
c**** title and ask for control file name default available        ****
c**********************************************************************

      write (*,'(/18x,''SCATTERING BY A CHANNEL WITH A DIVIDER'')')
      write (*,'(18x,''**************************************'')')
      write (*,'(/''Enter input file (default <CR>) : ''$)')
      read (*,'(a)') fnameInp
      if (fnameInp.eq.'') then
        fnameInp = 'default.inp'
      endif

c**********************************************************************
c**** Open input file and read in all relevant data                ****
c**********************************************************************

      call FOPEN(funitInp,fnameInp,'r')

      write (*,'('' Reading pTrunc, nTrunc (inf sum) ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) pTrunc,nTrunc
      write (*,'(2(1x,i4))') pTrunc,nTrunc

      write (*,'('' Reading np (numerical resolution of intgls ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) np
      write (*,'(1x,i5)') np

      write (*,'('' Reading aod ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) aod
      write (*,'(1x,f10.6)') aod

      write (*,'('' Reading bod ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) bod
      write (*,'(1x,f10.6)') bod

      write (*,'('' Reading theta0 ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) theta0
      write (*,'(1x,f10.6)') theta0

      write (*,'('' Reading kd (Start, Step, Npts) ... '')')
      read (funitInp,*) dummyChar
      read (funitInp,*) kdStart,kdStep,nkdPts
      write (*,'(2(1x,f9.5),1x,i4)') kdStart,kdStep,nkdPts

c**********************************************************************
c**** Close control file                                           ****
c**********************************************************************

      close(funitInp)

c**********************************************************************
c**** Define a file for results to go into and open it for writing ****
c**********************************************************************

      ind = LEN_TO_CHAR(fnameInp,'.')
      fnameRes = fnameInp(1:ind)//'res'
      call FOPEN(funitRes,fnameRes,'w')

      return

      end
