	INTEGER*4 FUNCTION LENGTH (STRING) !	SUBROUTINE LENGTH
	CHARACTER *(*) STRING
C************************************************************************
C***
C***	THIS FUNCTION DIFFERS FROM THE STANDARD LEN FUNCTION ONLY
C***	IN THAT IT RETURNS THE POSITION OF THE LAST NON-BLANK,
C***	NON-TAB, OR NON-NULL CHARACTER IN THE STRING, RATHER THAN 
C***	THE CAPACITY OF THE STRING VARIABLE.
C***
C************************************************************************
C*MCT
	CHARACTER*1 TAB  /'09'X/
	CHARACTER*1 NULL /'00'X/
C
C***	FIRST DETERMINE THE ACTUAL SIZE OF THE STRING VARIABLE
	I = LEN (STRING)
	IF (I .LE. 0) THEN
	    LENGTH = 0
	    RETURN
	ELSE
	ENDIF
C
10      DO WHILE (((STRING(I:I) .EQ. ' ')   .OR.
	1	   (STRING(I:I) .EQ. TAB)   .OR.
	2	   (STRING(I:I) .EQ. NULL)) .AND.
	3	  (I .GT. 0))
	    I = I - 1
	END DO
	LENGTH = I
	RETURN
	END
