      subroutine getrot (limmo, root, lenrot)

      integer limmo (2)
      character*(*) root
      integer* 2 lenrot

c get root directory for data

      character*80 mesage
      character*1 defalt/'D'/

      include 'basics.inc'

      if (lenrot .le. 2) then
        if (lenrot .eq. 0) root = defalt
        lenrot = len_trim(root)
      end if
      call dirnam ('Root data directory', defalt//':\', root, lenrot)
      do while (limmo(1) .eq. 0)
        call limons (root(:lenrot), limmo)
        if (limmo(1) .eq. 0) then
          lenmes = 0
          call append ('No ', mesage, lenmes)
          call append (root(:lenrot), mesage, lenmes)
          call append ('year\yearmo.FFB files found', mesage, lenmes)
          print *, mesage(:lenmes)
          lenrot = 0
        end if
        call dirnam ('Root data directory', defalt//':\', root, lenrot)
      end do
      return
      end

