File access question (Fortran 77) - please e-mail answer 
Author Message
 File access question (Fortran 77) - please e-mail answer

In general, sequential files have variable length records, while direct
access files have fixed length records which must be known to the program.
 On some systems, it may be possible to make a file which is formatted and
happens to have fixed length records, which might be accessible both
directly and sequentially, but this certainly isn't guaranteed by the
standard.
Tim



Mon, 07 Feb 2000 03:00:00 GMT  
 File access question (Fortran 77) - please e-mail answer

This is a multi-part message in MIME format.

------=_NextPart_000_01BCADA4.5DEBAF60
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

According to  "fortran for Scientists and Engineers" by David Weinman:

"In standard Fortran 77, it is not possible to create a sequential file
that can later be accessed directly."

Why would this be so?   I'm more interested in the mechanism that prevents
this access, than in the rationale behind it.  So far as I know, the
sequential and direct access files do not include, for example, header
records that define their types,  record size (in the case of Direct
access) etc..   The reason isn't, presumably, the format
(FORMATTED/UNFORMATTED) of the sequential file, since that is really just
an interpretation of the data in the file.

Since I have "inherited" a FORMATTED (ASCII) file that won't open (with
Lahey ELF90) by Direct access, I suppose it must be Sequential access.  But
I just don't see how the compiler or run-time module etc. can tell the
difference.

-  Bob Greer
   Bear Mountain Cartography

------=_NextPart_000_01BCADA4.5DEBAF60
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<html><head></head><BODY bgcolor=3D"#FFFFFF"><p><font size=3D2 =
color=3D"#000000" face=3D"Bookman Old Style">According to =
&nbsp;&quot;FORTRAN for Scientists and Engineers&quot; by David =
Weinman:<br><br>&quot;In standard Fortran 77, it is not possible to =
create a sequential file that can later be accessed =
directly.&quot;<br><br><br>Why would this be so? &nbsp;&nbsp;I'm more =
interested in the mechanism that prevents this access, than in the =
rationale behind it. &nbsp;So far as I know, the sequential and direct =
access files do not include, for example, header records that define =
their types, &nbsp;record size (in the case of Direct access) etc.. =
&nbsp;&nbsp;The reason isn't, presumably, the format =
(FORMATTED/UNFORMATTED) of the sequential file, since that is really =
just an interpretation of the data in the file.<br><br>Since I have =
&quot;inherited&quot; a FORMATTED (ASCII) file that won't open (with =
Lahey ELF90) by Direct access, I suppose it must be Sequential access. =
&nbsp;But I just don't see how the compiler or run-time module etc. can =
tell the difference.<br><br>- &nbsp;Bob Greer<br> &nbsp;&nbsp;Bear =

</font></body></html>
------=_NextPart_000_01BCADA4.5DEBAF60--



Mon, 07 Feb 2000 03:00:00 GMT  
 File access question (Fortran 77) - please e-mail answer



Quote:
> According to  "FORTRAN for Scientists and Engineers" by David Weinman:

> "In standard Fortran 77, it is not possible to create a sequential file
> that can later be accessed directly."

> Why would this be so?   I'm more interested in the mechanism that prevents
> this access, than in the rationale behind it. [...]

There is no mechanism as such.  The problem is that sequential
files *may* contain records of varying length.  Trying to access
those records directly would be difficult.  The way direct access
works is to position the file by multiplying the record length by
the record number given in the I/O request.  If the first N records
are not all of the same length, the direct I/O positioning to the
Nth record will be out of sync.

Rather that try to hash out all the conditions and proper responses
to this possibility, the committee just chose to disallow it.  Having
actually written an I/O support library for Fortran which allowed
direct and sequential accesses to be mixed, I can attest that
it's not a trivial task.

--
J. Giles
Ricercar Software



Mon, 07 Feb 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help: Lahey Fortran (Newbie question) - e-mail answer please

2. operation on files, keyed access,indexed organization, fortran 77

3. Answers to C calling Fortran 77 shared library on OSF/1 (long)

4. Fortran 77 File I/O Write and Format Question

5. FORTRAN 77: student in desperate need of answer!!!!

6. Wanted: Access of Commandline in OS/9 Fortran 77

7. Fortran 77 programs please ?

8. Advice on FORTRAN-77 books, please

9. Help: Newbie FORTRAN I/O question (ELF90) - e-mail reply please

10. Questions-Questions-Questions-Answers-Answers

11. Fomatted read from a csv file (FORTRAN 77)

12. fortran 77 i/o of poorly formatted file

 

 
Powered by phpBB® Forum Software