c
c @(#)mlrrs.f	1.2
c
      subroutine mlrrs

      include 'mladv.inc'

      common/parm/kz,m,mm1,mm2,mp1,msq,tim,tmax,tstart,hy,rea,dt,
     +   xbasin,yy(mx0),icalc,kzp1,kzm1,iftop,ifbot,iftvv,ifrel,theta,
     +   ifsbl,ifeva
      common/extpar/rlat0,rlng0,t0,v0,dhor,ht,time0,
     +                r0,f0star

      real omltime

      open(unit=imlrrs,file=fmlrrs,form='unformatted',status='old')

      rstol = 2.5 * dt * t0 / 86400.

  1   continue

      read(imlrrs,end=3)omltime
      read(imlrrs)mlcur,mlpast,imlcnt,iwcur,iwpast,icw
      read(imlrrs)strm0
      read(imlrrs)wsurf
      read(imlrrs)wzvel
      read(imlrrs)hdpth
      read(imlrrs)buoy
      read(imlrrs)temp
      read(imlrrs)trace
      read(imlrrs)bnddpth
      read(imlrrs)bndbuoy
      read(imlrrs)bndtemp
      read(imlrrs)bndtrace
      read(imlrrs)adv
      read(imlrrs)szz
      read(imlrrs)taux
      read(imlrrs)tauy

      if ( abs(mltime - omltime) .lt. rstol ) then
         write(*,*)'SBL restart information read ',omltime,mltime
         return
        endif

      goto 1

  3   continue

      write(*,*)'End of sbl restart file reached.'
      stop

      end
