      integer function nextlu()
      logical isopen
c
c Return an unused fortan logical number (not 5 or 6):
c
      do lu=7,99
        inquire(lu,opened=isopen)
        if (.not.isopen) then
          nextlu = lu
          return
        endif
      enddo
      write(6,"(/'>>> nextlu: all logical units apprantly in use')")
      nextlu = 0
      stop 'nextlu'
      end

