Re: The concept of a record



qsc <qingshan.chen@xxxxxxxxx> wrote:
I found it hard to understand the concept of a record in Fortran I/O.

Here are some of the questions I have about it.

The answers to your questions depend on whether you have formatted or
unformatted I/O.

1. one record is equivalent to one line?

In formatted I/O, yes. In un formatted I/O the concept of a line
doesn't exist.


2. Each read, write or print statement deal transfer one record?

In unformatted I/O, yes (unless you use "advance=no", then you only
get part of a record). In formatted I/O, one I/O statement can deal
with several records. E.g., a "/" format item starts a new record. If
you run off of the end of the format string and you have still items
left in the I/O list, a new record will be started.


3. What if in one write statement I want output several values? Will
they be treated as one record, or splitted into several? For example:
write(12) U(:)
Notice that I want binary output, and the array U have many
components. So now, will U be written in one record, or many?

One record.

Will the
output be on one line, or many?

There is no line, write(12) U(:) is unformatted I/O. You may be
confusing this with write(12,*) U(:). This is formatted, list-directed
I/O. Here, the compiler or run time system is free to produce several
records or lines. It will usually do so if the line gets too long
otherwise.



Thanks in advance!

--
Klaus Wacker klaus.wacker@xxxxxxx
Experimentelle Physik V http://www.physik.uni-dortmund.de/~wacker
Universitaet Dortmund Tel.: +49 231 755 3587
D-44221 Dortmund Fax: +49 231 755 4547
.



Relevant Pages

  • Re: Variable length/precision formats?
    ... having it work like VFEs ... indirect interactions with the I/O list, ... The feature is ... the *FORMAT* is still list-directed in the above. ...
    (comp.lang.fortran)
  • Re: Read Format
    ... That statement as is just skips a line, as you have no I/O ... array of double precision type. ... what your problem isn't - namely in the I/O format. ... DOUBLE PRECISION:: tol, sum_e2 ...
    (comp.lang.fortran)
  • Re: Pretty printing experts, pretty please?
    ... T _is_ a stream designator for terminal I/O, but FORMAT does not ... streams for *terminal-io*, and because the LispM had windowing, every window ...
    (comp.lang.lisp)
  • Re: Read Format
    ... That statement as is just skips a line, as you have no I/O ... array of double precision type. ... characters (one before the decimal, the decimal itself, 15 after the ... what your problem isn't - namely in the I/O format. ...
    (comp.lang.fortran)
  • Re: a modest proposal
    ... OS/360 object programs are 80 byte fixed ... I/O using A format. ... file with JCL and associate it with a Fortran I/O unit number? ...
    (comp.lang.fortran)