      module casing

        interface operator ( + )
          module procedure upper_case
        end interface

        interface operator ( - )
          module procedure lower_case
        end interface

      contains

        function upper_case ( old ) result ( new )
        character*20              :: new
        character*20, intent(in ) :: old
        new = old
        do i = 1, len_trim(old), 1
           if ( lge ( old(i:i), 'a' ) .and. &
                lle ( old(i:i), 'z' )       )  &
                new(i:i) = achar ( iachar(old(i:i)) - 32 )
        end do
        end function upper_case

        function lower_case ( old ) result ( new )
        character*20              :: new
        character*20, intent(in ) :: old
        new = old
        do i = 1, len_trim(old), 1
           if ( lge ( old(i:i), 'A' ) .and. &
                lle ( old(i:i), 'Z' )       )  &
                new(i:i) = achar ( iachar(old(i:i)) + 32 )
        end do
        end function lower_case

      end module casing
