      logical function is_int_num(str)
C
C Description: 
C This function returns true if the character string 'str' contains only an 
C integer number. There must be no blanks between characters, the 
C first character must be a decimal digit, a '+' or '-' sign. All 
C following characters must be decimal digits. There must be at least 
C one decimal digit.
C     
C Name         in/out type          Structure  Meaning
C is_int_num   out    logical       scalar     Returned TRUE if the input 
C                                              string contains a valid 
C                                              integer number as 
C                                              described above
C str          in     character(*)  scalar     The string containing the   
C                                              characters to be tested. 
C
C Errors:
C
C There should be no errors returned from this routine.
C     
      implicit none
      logical is_digit,done,sign,one_digit
      integer ptr1,ptr2,fnblnk,lnblnk,i
      character*(*) str
      character*1 first
      is_int_num=.true.
      ptr1=fnblnk(str)
      if (ptr1 .gt. 0) then
         ptr2=lnblnk(str)
         first=str(ptr1:ptr1)
         sign=((first .eq. '+') .or. (first .eq. '-'))
         if (sign) then
            i=ptr1+1
         else
            i=ptr1
         end if
         done=.false.
         one_digit=.false.
         do while ((.not. done) .and. (i .le. ptr2))
            if (is_digit(str(i:i))) then
               one_digit=.true.
            else
               done=.true.
               is_int_num=.false.
            end if
            i=i+1
         end do
         is_int_num=one_digit .and. is_int_num
      else
         is_int_num=.false.
      end if
      return
      end
