SUBROUTINE GETSTR (LUN, AREA, MAXLEN, ERR) C***************************************************************************** C C Description : Gets a string from a specified logical unit. C C Arguments : LUN = Integer, containing the logical unit number of the unit C to get the string from C AREA = STRING in which the input is to be placed C MAXLEN = INTEGER, containing the maximum length of the input C string C ERR = LOGICAL indicating whether there has been an error. C If there is an error then ERR indicates which one: C ERR = -1: End of file detected C -2: Hardware error C -3: Record length error C C Author : H.A.M. Fikke C AKZO PHARMA, Oss Holland C dept. SDA C C Version : V1.1 Date : 21-apr-83 C C Module name : GETSTR.FTN C C Package : RSXLIB C C Compilation/Linking : FORT/F4P/TR:NONE GETSTR C C Updates : name version C F.A.Minkema V1.1 C C description : C CTRL/Z processing corrected by clearing buffer. C C***************************************************************************** C C LOGICAL*1 AREA(1),ERR ERR=.FALSE. !Initialize error flag AREA(1)=0 !Clear buffer 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 error GOTO 3 2 ERR=-2 !Hardware error 3 RETURN 9 FORMAT(Q,250(250A1)) END