* ======================================================================
* ==================================================================== *
      subroutine SIZSTR (string, first, last)
* -------------------------------------------------------------------- *
*
* Comments: returns first and last non blank character
*
* author:F.Colonna
* date:Tue Sep 22 15:25:28 GMT 1992
* -------------------------------------------------------------------- *
*
      implicit none

* i/o scalars  :
      character*(*) string
      integer first, last
* local   :
      integer is, lenstr,uniout
      logical found, max

* begin   :
      uniout=2
      found = .false.

      first=0
      last=0
      lenstr = len(string)
*     write(*,*) 'string="',string,'"'
*     write(*,*) 'lenstr=',lenstr
      if(lenstr.eq.0) then
          write(*,'(a)')
     .'   error_sizstr> zero length string'
          stop '   error_sizstr> zero length  string'
      end if

      max = .false.
      is = lenstr

      do while (.not.found.and..not.max)
           last = is
           found = string(is:is) .ne. ' '
           is = is - 1
           max = is .eq. 0
      end do

      if(max) then
          if(.not.found) then
*           write(uniout,'(a)')
*    .    ' warning_sizstr> empty string'
            first = 1
            last = 1
            string = ' '
          else
            first = 1
            last = 1
          end if
          return
      end if

      found = .false.
      max = .false.
      is = 1
      do while (.not.found.and..not.max)
           first = is
           found = string(is:is) .ne. ' '
           is = is +1
           max = is .eq. lenstr+1
      end do

      if(max) then
          write(*,'(a)')
     .  ' error_sizstr> strange  string'
          stop ' error_sizstr> strange  string'
      end if


* end of routine SIZSTR
      return
      end
