Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!rutgers!ucsd!ucbvax!agate!violet.berkeley.edu!jerry From: jerry@violet.berkeley.edu ( Jerry Berkman ) Newsgroups: comp.lang.fortran Subject: Backspacing across an EOF Message-ID: <18503@agate.BERKELEY.EDU> Date: 21 Dec 88 01:55:33 GMT Sender: usenet@agate.BERKELEY.EDU Reply-To: jerry@violet.berkeley.edu ( Jerry Berkman ) Organization: University of California, Berkeley Lines: 47 How many records should be in the file created by: do 10 i=1,10 write(12,8010) i 8010 format(' record ',i5, '.' ) 10 continue rewind 12 call skptoend( 12 ) write(12,8000) 8000 format(' new record at end') end subroutine skptoend( lunit ) 100 continue read ( lunit, '()', end=200 ) go to 100 200 backspace lunit end On our VAX UNIX, Sun UNIX, and IBM CMS systems, the file looks like: record 1. record 2. record 3. record 4. record 5. record 6. record 7. record 8. record 9. record 10. new record at end However, on our Cray UNICOS system and a VMS system I tested, the record "record 10." is missing from the final output. As I read the standard, section 12.10.4.1 (Backspace): "... if the preceding record is an endfile record, the file becomes positioned before the endfile record" and section 12.6: "[if] An endfile record is encountered during [reading] the file is positioned after the endfile record." Does anyone know DEC's or Cray's position on this? - Jerry Berkman, U.C. Berkeley jerry@violet.berkeley.edu, (415)642-4804