Path: utzoo!attcan!uunet!husc6!bbn!uwmcsd1!ig!agate!ucbvax!VENUS.YCC.YALE.EDU!LEICHTER From: LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU) Newsgroups: comp.os.vms Subject: re: Curious as to how Fortran BACKSPACE works Message-ID: <8805241003.AA06934@ucbvax.Berkeley.EDU> Date: 22 May 88 02:41:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 20 I am curious as to how Fortran BACKSPACE works. I vaguely remember reading in one of the orange manuals that BACKSPACE simply causes the logical unit to be rewound and read from THE BEGINNING forward to the record immediately preceding the current one. Is this true? How are huge time delays avoided when BACKSPACE'ing large files, or are delays not avoided? Or do I remember wrong, and does BACKSPACE use the saved (?) position of the start of the previous record to do its task? As I understand it, the implementation does the second most obvious thing (the obvious thing being to simply read again from the beginning of the file): As you read forward, the FORTRAN I/O system keeps a record of where the records it sees occur (by storing RFA's). It can then backspace by just seeking. Obviously, it can't store an indefinite number of RFA's, but by being a bit clever (say, always keep a the last 50 RFA's, then every RFA in steps of 50 before that for some fixed number of records, with an ultimate fallback to seeking back to the beginning of the file) it can handle most BACKSPACE requests - which are usually for only a couple of records - quite efficiently using only a small amount of space. -- Jerry