C This file: http://ftp.aset.psu.edu/pub/ger/fortran/hdk/enter.for C DOUBLE PRECISION X(5) CHARACTER*80 STRING DO 1 I=1,10 C---For PC Watfor77: pressing C only Ctrl-Z followed by pressing Enter will take the END= branch. READ(5,2,END=99) STRING 2 FORMAT(A) C---To use this heuristic with numeric data, first read STRING then C read from that STRING if it is not "Only Blanks and or Enter Key" WRITE(6,*) 'Record # ',I,' read.' IF(STRING.EQ.' ') THEN WRITE(6,*) 'Only Blanks and/or Enter key' ELSE C---Initialize numeric array X to -Infinity so that if not 5 (in this C case) values are entered, the remaining values of the array will C retain the "-Infinity" value given here. This code could be moved C to the begining of the DO 1 loop so that all of the array X would C be "-Infinity" when only blanks and/or the Enter key was pressed. DO 3 J=1,5 3 X(J)=-1.D-75 READ(STRING,*,END=4) X 4 WRITE(6,*) X ENDIF 1 CONTINUE 99 WRITE(6,*) I-1,' Records read.' STOP END