'      INTEGER*4 FUNCTION LENVAL(STRING)CFC_TITLE:   LENVAL:  Determines length of valid PDS label keyword valueC C_ARGS:H      CHARACTER*(*) STRING	! I  Value string whose length is to be foundC *C_KEYS:    PDS, FILE_LABEL, STRING_PARSINGC PC_DESCR:   Function returns the length of a valid PDS label keyword value stringIC          or -1 if the string is invalid.  A valid string is defined by:HC            Spaces and tabs at the beginning of the string are ignored.JC            If string does not begin with a single quote, double quote orIC	      left parenthesis, string ends at character preceding first space,C	      tab, /* or <cr>.HC            If string begins with a single quote, string ends at second9C             single quote. (Invalid string if only one.)HC            If string begins with a double quote, string ends at second9C             double quote. (Invalid string if only one.)KC            If string begins with a left parenthesis, string ends at rightDC             parenthesis. (Invalid string if no right parenthesis.)$C          A null string returns 0. ?C	   Function operates on pre-parsed label - i.e. CR/LFs withinAC	    statements have been removed, so that label consists solelyCC	    of valid PDS statements separated by CR/LFs.  CR/LF is within8C	    statement if within an open text string or vector.C5C_LIMITS:  Multi-level vectors are not yet supported.CC	   Vectors may not contain parentheses, even in literals or text.C*C_KEYS:    PDS, FILE_LABEL, STRING_PARSINGCEC_HIST:    86apr__  R. Mehlman (RMX) UCLA/IGPP  ORIGINAL NIMS VERSIONBC	   87may27  RMX  PDS version, supporting literals, text strings,C			  & single level vectors<C	   87aug18  RMX  Added LEN function to set being minimized C	   87oct26  RMX  DocumentationC C_END:C      CHARACTER*1 CR,TAB      BYTE KCR /13/ , KTAB /9/      INTEGER LARGE /32767/C      CR=CHAR(KCR)      TAB=CHAR(KTAB)2      IF (STRING(1:1).EQ.' ') THEN		! NULL STRING?		LENVAL=0	RETURN      ENDIF      LENVAL=-16      IF (STRING(1:1).EQ.'"') 			! TEXT STRING (IN "S)%     1 LENVAL=INDEX(STRING(2:),'"')+12      IF (STRING(1:1).EQ.'''')			! LITERAL (IN 'S)&     1 LENVAL=INDEX(STRING(2:),'''')+19      IF (STRING(1:1).EQ.'(')			! VECTOR (IN PARENTHESES)=     1 LENVAL=INDEX(STRING(2:),')')+1		!  (SINGLE LEVEL ONLY)=      IF (LENVAL.EQ.1) THEN 			! SET INVALID IF NO TERMINATOR
	LENVAL=-1	RETURN      ENDIF9      IF (LENVAL.LT.0) THEN			! NOT TEXT, LITERAL, VECTOR!C	LENVAL=INDEX(STRING(2:),' ')		!.	L1=INDEX(STRING(2:),' ')		! *** temp code ***6	IF (L1.LE.0) L1=LARGE			!     replace after pre-parse	L2=INDEX(STRING(2:),CR)	IF (L2.LE.0) L2=LARGE	L3=INDEX(STRING(2:),TAB)	IF (L3.LE.0) L3=LARGE	L4=INDEX(STRING(2:),'/*')	IF (L4.LE.0) L4=LARGE	L5=LEN(STRING)5	LENVAL=MIN0(L1,L2,L3,L4,L5)		! *** end temp code ***      ENDIF      RETURN	      END