Re: How to use REWIND COMMAND of FORTRAN77 in FORTRAN 90



David Flower <DavJFlower@xxxxxxx> wrote:

> vinnie wrote:
> > Here i am using REWIND command at the end to read the
> > nodal connectivity of a element.As i have like 1000 elements i have to
> > rewind the process to the beginning to read each element's nodal
> > connectivity every time.

> REWIND 42
....

> That being said, I am surprised that you need to do it. Can you not
> store the data in memory when you read the file, and copy them each
> time they are required to be reset

Or, alternatively, if there is some real reason why that won't work, one
could make the file direct access instead of sequential. That would,
however, require that the file be written as direct access in the first
place (or that you did an initial pass to copy the sequential file to a
direct access one); you can't generally just take a "normal" sequential
file and read it as direct access. I'd generally agree with David that
reading it all into memory in one pass is probably preferred; the direct
access alternative is only for if that approach won't do.

Also, the subject line a bit puzzles me. I'll skip over the common
confusion of "statement" vs "command" (Fortran doesn't have commands),
but the Fortran 77 vs Fortran 90 part confuses me. The subject line
makes it sound like the OP knows how to do it in Fortran 77 and wants to
know how to do the same thing in Fortran 90. The answer to that would
then be "the same way as you do in Fortran 77". I suspect I am reading
more into the subject line than was intended, but I'll provide this
answer just in case the OP actually was asking about F77 vs f90
differences.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.



Relevant Pages

  • Re: Namelist I/O and direct access files
    ... My least favorite of all Fortran books. ... direct access may well not be as efficient as sequential. ... It is very tricky to do formatted I/O without rounding errors. ... default integers and reals take the same space; ...
    (comp.lang.fortran)
  • Re: Namelist I/O and direct access files
    ... > versus the dozen or so characters, depending on the exact format, that ... >>sector size of a particular computer are the most efficient Fortran files ... I know pretty much defined a file system inside a direct access file ...
    (comp.lang.fortran)
  • Re: how to read the last line of an input file (F77)?
    ... normal cr-lf. ... then the solution is easy - just open a direct access UNFORMATTED file ... I NEVER assume the user is using the latest bells-and-whistles Fortran ... be caught by compiler run-times. ...
    (comp.lang.fortran)
  • Re: Fortran to VB.net
    ... code to FORTRAN 95 and cleaning up the code but he was insistent so I ... An example of READ, REWIND, and FORMAT in use: ... KRis the logical unit. ...
    (comp.lang.fortran)