       SUBROUTINE readhamontable3(maxyear,ntyp,doffDA,doffDB,doffZD,
     *  nyearmin,nyearmax)

c    readhamontable2 reads dats from hamon table 2 for deep probes
c    deployed in low and high temperature waters

      parameter (icmax=10)
      character*80 text,filename

      dimension doffDA(maxyear,ntyp)
      dimension doffDB(maxyear,ntyp)
      dimension doffZD(maxyear,ntyp)
      dimension icomma(icmax,2)

      call extraname('sys.inf'//CHAR(0),
     * 'hamon_table3.txt'//CHAR(0),filename)
      open(9,file=filename,status='old')

c     reading headers
      read(9,'(a)') text
      read(9,'(a)') text
c     read in data
c     column 1: year
c     column 2: ADL
c     column 3: BDL
c     column 4: ZoffDL
c     column 5: ADH
c     column 6: BDH
c     column 7: ZoffDH

      nyearmax=0
      nyearmin=maxyear
      do 50 ny=1,maxyear

      call clearstring(text,80)
      read(9,'(a)', end=4) text
      call findlastchar(nsp,text,80)

      call commafindx(nsp,icmax,ncomma,icomma,text)
       if (ncomma .lt. 2) goto 50

       read(text(icomma(1,1):icomma(1,1)+icomma(1,2)-1),*)
     * nyear
       if (nyear .lt. nyearmin ) nyearmin=nyear
       if (nyear .gt. nyearmax ) nyearmax=nyear
       
       read(text(icomma(2,1):icomma(2,1)+icomma(2,2)-1),*)
     * doffDA(nyear,3)
       read(text(icomma(3,1):icomma(3,1)+icomma(3,2)-1),*)
     * doffDB(nyear,3)
       read(text(icomma(4,1):icomma(4,1)+icomma(4,2)-1),*)
     * doffZD(nyear,3)

       read(text(icomma(5,1):icomma(5,1)+icomma(5,2)-1),*)
     * doffDA(nyear,4)
       read(text(icomma(6,1):icomma(6,1)+icomma(6,2)-1),*)
     * doffDB(nyear,4)
       read(text(icomma(7,1):icomma(7,1)+icomma(7,2)-1),*)
     * doffZD(nyear,4)

c      write(6,*) nyear,doffDA(nyear,3),doffDB(nyear,3),doffZD(nyear,3)
c     * ,doffDA(nyear,4),doffDB(nyear,4),doffZD(nyear,4)


50     continue
4      continue
       close(9)

       return
       end

