[comp.sys.apollo] ms_$mapl and FORTRAN I/O

FERGUSON@TMASL.EXXON.COM (04/28/89)

Well, I figured out how to make uasc files and use ms_$mapl:

     Use fopen to create the file, then fclose it. Now that the
     file already exists, you can map it without creating a nil
     type. Now, on to the next problem.

When I write files using ms_$mapl or C 'write' statements, the bytes
go exactly where I expect them to go. Only problem is, I have another
program in FORTRAN which uses the unformatted READ on the same files.
I constantly get the error:

      'data overflows buffer size'

I guess I either need end-of-record characters, or I need to change my
record length accordingly. Anyone have any experience with this? Anyone
know what character the end-of-record is, if there is one?

Thanks to anyone who can help,
Scott Ferguson
ferguson@erevax.bitnet

krowitz@RICHTER.MIT.EDU (David Krowitz) (04/28/89)

Fortran unformatted files do not contain any end-of-record characters.
They contain a record count at the beginning of each record. The
contents (and exact location) of the record count is different
depending on whether you have an REC file or an UNSTRUC file.
You should not be able to do an unformatted Fortran read on a UASC
file. Under SR9, unformatted Fortran files are REC type files, under
SR10 they are supposed to be UNSTRUCT type files, although SR10 will
read either type, it will only create the latter. With the REC type
files, each record in the files contains a 32-bit counter at the
beginning of the record. The contents of this counter is the number
of bytes in the record including the counter (ie. bytes of data + 4).
The counter is followed immediately by the data. All floating point
and integer data is word-aligned on 16-bit boundaries. Since the
record count is a integer, all records start on even byte addresses.
Of course, you also must remember that REC files (and UASC files)
have a 32-byte headers and that the first record count starts after
that header.


 -- David Krowitz

krowitz@richter.mit.edu   (18.83.0.109)
krowitz%richter@eddie.mit.edu
krowitz%richter@athena.mit.edu
krowitz%richter.mit.edu@mitvma.bitnet
(in order of decreasing preference)