      integer function len_trim (string)

c  return the trimmed length of a character string

      character*(*) string

      do len_trim = len(string), 1, -1
        if (string(len_trim:len_trim) .ne. ' ') return
      end do
      len_trim = 0
      return
      end
