C.MODULE GETSTR,VERSION=01,COMMENT=<FORTRAN Get string>,LIB=YES
C
C THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY  BE  USED
C OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
C
C     COPYRIGHT (c) 1984,1985 BY DIGITAL EQUIPMENT CORPORATION.
C			ALL RIGHTS RESERVED.
C
	SUBROUTINE GETSTR( LUN, AREA, MAXLEN, ERR )
	LOGICAL*1 AREA (1),ERR
	ERR = .FALSE.			!INITIALIZE ERROR FLAG
	READ(LUN,9,END=1,ERR=2) ITMP,(AREA(I),I=1,MAXLEN)
	AREA(MAXLEN+1)=0		!TERMINATE STRING
	CALL TRIM(AREA)			!GET RID OF TRAILING BLANKS
	IF (ITMP.GT.MAXLEN) ERR=-3	!LOOK FOR RECORD LENGTH ERROR
	GOTO 3
1	ERR = -1			!END-OF-FILE
	GOTO 3
2	ERR = -2			!HARDWARE ERROR
3	RETURN
9	FORMAT(Q,250(250A1))
	END
