      INTEGER BSIZE
	  PARAMETER (BSIZE=132)
      CHARACTER*(BSIZE) BUF
	  CHARACTER*80 FILNAM
      INTEGER READFL
      INTEGER NLINES
      INTEGER I

      READ(*,'(A)')FILNAM

      OPEN(UNIT=10,FILE=FILNAM,STATUS='OLD',ERR=200,FORM='FORMATTED')

      DO 100 I=0,1
          NLINES = READFL(10, BUF, BSIZE)
		  WRITE(*,*)'Read', NLINES, ' lines'
          CALL CKPT
100   CONTINUE
      CALL EXIT(0)
      GO TO 300
200   WRITE(*,*)'Open failed'
      CALL EXIT(1)
300   END

      INTEGER FUNCTION READFL(FD, BUF, BSIZE)
      INTEGER FD
      CHARACTER*(*) BUF
      INTEGER BSIZE

	  REWIND(UNIT=10)
	  READFL=0
100   READ(FD,'(A)',END=150,ERR=200)BUF(1:BSIZE)
      READFL=READFL+1
	  GO TO 100

150   RETURN

200   CALL EXIT(1)
      END
