      character*(*) function downcase_str(str)
C
C Description:
C
C This function returns the input string with all the uppercase letters
C converted to lowercase letters.
C
C User interface:
C
C Name         in/out type          Structure  Meaning
C
C downcase_str out    character(*)  scalar     A copy of the input string with 
C                                              uppercase letters converted to
C                                              lowercase
C str          in     character(*)  scalar     The string to be converted to
C                                              lowercase
C
C Errors:
C
C No errors are trapped in this routine.
C
C Routines accessed
C 
C is_upcase
C
      implicit none
      logical is_upcase
      integer i,limit
      character*(*) str
      limit=len(str)
      downcase_str=' '
      do i=1,limit
         if (is_upcase(str(i:i))) then
            downcase_str(i:i)=char(ichar(str(i:i))+32)
         else
            downcase_str(i:i)=str(i:i)
         end if
      end do
      return
      end
