home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!spam!jnixon
- From: jnixon@spam.ua.oz (John Nixon)
- Newsgroups: comp.lang.fortran
- Subject: Re: Reading C output in FORTRAN
- Summary: direct access
- Message-ID: <1628@spam.ua.oz>
- Date: 29 Jul 92 08:06:12 GMT
- References: <1992Jul24.172254.24198@ll.mit.edu>
- Organization: Statistics, Pure & Applied Mathematics, University of Adelaide
- Lines: 47
-
- In article <1992Jul24.172254.24198@ll.mit.edu> akearns@ll.mit.edu ( Adam Kearns) writes:
-
- > Hi. We have some files on a VAX that are STREAM_LF type, and we would
- >like to read them in FORTRAN using the READ command. The file has a
- >fixed length of 16384 bytes. The problem is that using the READ command
- >doesn't seem to move the file pointer to the where it stopped reading, so
- >we read the same data over again. We have a way using QIO to read in the
- >file, but that requires computing the number of disk blocks we read and
- >starting from there. This technique is rather inconvienent, espically
- >if a record ends in the middle of a disk block (for a different file,
- >obviously this one does). It would be nice to be able to use the READ
- >command and have the program keep track of where it is in the file
- >like you can in VAX C. Any suggestions would be appreciated.
-
- Use something like:
-
- open(unit = iunit, status = 'old', file = name,
- & access = 'direct', recl = irecl,
- & iostat = istat, err = 10610, form = un_formatted)
-
- which I have use on a Sun, and does work. My files were actually
- created by a FORTRAN program on a CRAY and had the 64-bits reduced to
- 32-bits by the UNICOS (i.e. CRAY Unix) OS, so the unformatted files had
- numbers without the usual extranaous junk associated stripped off. Then
- you need something like:
-
- irec = 1
- read(unit = 1, rec = irec, err = 10060, end = 10070) nc1, nc2
- irec = irec + 2 * nbytes
-
- where it is assumed:
-
- parameter (irecl = 1)
- parameter (nbytes = 4)
-
- holds and *you* have to keep track of where you are by updating irec at
- appropriate times.
-
- All this was actual code taken from working programs and hopefully
- explains itself pretty much.
-
- Later,
-
- --
- John Nixon {Research Dude} jnixon@spam.maths.adelaide.edu.au [08 228-5407]
- Department of Applied Mathematics, The University of Adelaide, SA, AUSTRALIA
- "Anonymous Techno Act" Sample of the Week: "Music & noise. Noise & music."
-