Ben Blackwell wrote: > F90 Group: > I have a need to extract the last nine records of an input file when I do not know (at least conveniently) the total number of records in the file. I thought I could use ENDFILE (UNIT) followed by BACKSPACE(UNIT) over the nine records. However, this seems to wipe out the contents of the input file. The open statement for the file is of the form: > OPEN(UNIT=KINP,FILE='file_name',STATUS='OLD') Try adding POSITION = 'APPEND' to the OPEN. That will put file just before the end-file, ready to write the next record. Then BACKSPACE 9 times and start reading. ENDFILE is an output statement. It writes an endfile mark at the current position, it doesn't jump to an existing endfile mark, unfortunately. Also, for Fortran sequential files (the kind you got with that OPEN), writing anything (including an endfile) effectively deletes everything after that point. You can't change something in the middle of a sequential file. Dick Hendrickson > > Any suggestions would be appreciated. > > Thanks, > Ben Blackwell >