From: glen herrmannsfeldt on
Greg Lindahl wrote:

> In article <1igeuzv.sq8yt61wrjlyxN%wclodius(a)los-alamos.net>,
> William Clodius <wclodius(a)los-alamos.net> wrote:

>>>Indirectly through the BACKSPACE command, you mean? You can't backspace
>>>efficiently on a disk without the postfix.

>>You can, but it requires the run time library to retain a record of the
>>prefixes,

> Uh, no. That would work if you read through the file before you start
> backspacing. But users can easily start at the end of the file, and
> users who just want to read the last record would be up in arms if
> your implementation had to read the entire file to backspace one
> record.

In Fortran 66, I don't believe that there is a way to get to the
end of a file without reading all the way through. As far as I
can tell, now you can open in APPEND mode and start BACKSPACE from
the end.

The system used for Fortran UNFORMATTED files for OS/360, and still
used with newer ESA/390 and z/OS systems, has record headers and
block headers. Following the headers through a block isn't so
hard, and the OS keeps track of blocks. They don't have
record trailers.

Doing C style fseek() can require reading from the beginning
under some conditions, though.

-- glen

From: Richard Maine on
glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:

> In Fortran 66, I don't believe that there is a way to get to the
> end of a file without reading all the way through. As far as I
> can tell, now you can open in APPEND mode and start BACKSPACE from
> the end.

I believe I've seen implementations where that wouldn't work; if you
opened with append, the only thing you could do was append.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
From: glen herrmannsfeldt on
Richard Maine wrote:

> glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:

>>In Fortran 66, I don't believe that there is a way to get to the
>>end of a file without reading all the way through. As far as I
>>can tell, now you can open in APPEND mode and start BACKSPACE from
>>the end.

> I believe I've seen implementations where that wouldn't work; if you
> opened with append, the only thing you could do was append.

Neither the POSITION='APPEND' for OPEN, nor BACKSPACE mention
that it might not work. I just notice, though, in the POS=
option to READ and WRITE for Fortran 2003, 9.5.1.10:

"A processor may prohibit the use of POS= with particular files
that do not have the properties necessary to support random
positioning. A processor may also prohibit positioning a
particular file to any position prior to its current file
position if the file does not have the properties necessary
to support such positioning."

So it might be that BACKSPACE also doesn't work on such files.

-- glen

From: John Harper on
In article <560c2727-01b8-46a3-8bb6-6f2f769891a8(a)f24g2000prh.googlegroups.com>,
octaedro <jorge.alonsoortiz(a)gmail.com> wrote:
>Hello folks,
>
>I have been programming in fortran for about a year and a half since I
>wrote my "Hello World" program. Since then my projects get bigger and
>bigger and although I own two fortran manuals... Metcalfe, Reid and
>Cohen, and Ellis, Phillips and Lahey, I still do not know very well
>how to set options on my compiler to make programs run fast or how to
>do profiling of the programs..

MR&C is a textbook about Fortran in general, not about any particular
compiler's options. EP&L appears from the amazon.com ad to be another,
but I have never seen the book itself.

What you need now is the manuals (paper, or more likely these days, on-
line) for your own compiler and operating system. All the compilers I
know have options to do what you're asking for, but you request those
options differently with different compilers.

Although error-checking options may slow your program down, failing to
use them is one way Fortran got the reputation of being a language that
gave wrong answers fast. Other ways often mentioned here are failing to
do numerical analysis properly and failing to appreciate the properties
of floating point.

-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper(a)vuw.ac.nz phone (+64)(4)463 6780 fax (+64)(4)463 5045
From: William Clodius on
Greg Lindahl <lindahl(a)pbm.com> wrote:

> In article <87608c18-c5a7-44d2-bf4b-2192f65cf6d2(a)u12g2000prd.
>googlegroups.com>,
> Terence <tbwright(a)cantv.net> wrote:
>
> >b) Tape, as noted, can be read backwards in certain modes. That is why
> >the direct access formatted mode has prefixes and postfixes,
>
> Indirectly through the BACKSPACE command, you mean? You can't backspace
> efficiently on a disk without the postfix.
>
> -- greg
You can, but it requires the run time library to retain a record of the
prefixes, e.g., in a linked list or equivalent, or have an OS similar to
the old Mac OS that retained file descriptor information in a spearate
file. Remoing the postfix information would impact portability of
Fortran files. Which method is most efficient would depend on the
relative impact of reading additional information off the disc versus
retaining information in RAM, or a different location on the disc, and
the relative frequency of backspacing.