      FUNCTION LENGTH (STRING)
C                                                                               
C          ROUTINE TO FIND THE LENGTH OF A CHARACTER STRING.                    
C          THE LENGTH IS DEFINED AS THE POSITION OF THE LAST                    
C          NON-BLANK CHARACTER.  LENGTH=0 IF STRING IS BLANK.                   
C                                                                               
      IMPLICIT  INTEGER (A-Z)                                                   
      CHARACTER STRING*(*)                                                      
           
      DO 400 N=LEN(STRING),1,-1                                                 
      IF(STRING(N:N) .NE. ' ') THEN                                             
         LENGTH = N                                                             
         RETURN                                                                 
      ENDIF                                                                     
400   CONTINUE                                                                  

      LENGTH = 0                                                                
      RETURN                                                                    
      END                                                                       
