| This format is documented in the user manual.
There are two layouts for unformatted files - the default on VMS is the
"Fortran SEGMENTED" type. This is an RMS VAR (varying-length records) file
which means that for each record there is a 16-bit length followed by the data.
RMS will add a pad-byte after the data if the length is odd. In the data,
Fortran puts two bytes of flags at the beginning. This is the "segment control
word". The defined values are:
00 - this is neither the first nor the last segment in this record
01 - this is the first segment in this record
02 - this is the last segment in this record
03 - this is the only segment in this record
For long Fortran records (where "long" by default is about 1024 bytes),
the Fortran record is broken up into two or more segments, each segment being
an RMS record. Keep in mind that to RMS, the segment word is data, so the
RMS record length is two more than the length of the data part of the segment.
I'm not sure what is causing the "something at every 512 bytes" - a lot would
depend on what the RECL was.
One can also open the file with RECORDTYPE='VARYING' - this uses the RMS
VAR recordtype with no segment information, or with RECORDTYPE='FIXED' (which
is probably not an issue here.)
With either SEGMENTED or VARYING, it is critical that the file be transferred
in a way that preserves the RMS record length word. By default, this will
be stripped off by FTP. On VMS, UCX FTP has PUT/RAW which will just move the
blocks of data, leaving the recordlengths (and padding) alone.
Digital Fortran on Digital UNIX can read VMS SEGMENTED files *IF* the file
has been transferred "/RAW" and the file is opened with RECORDTYPE='SEGMENTED'.
If the user has control over the VMS application, and if all the records are
the same length, I would recommend that RECORDTYPE='FIXED' be used with an
appropriate RECL. This will remove the issue of RMS record lengths. Another
approach is to convert the VMS file to something that UNIX will like - see
http://quark.zko.dec.com/fortran/vmsvar_to_unix.for for a program that will
convert RECORDTYPE='VARIABLE' files to a UNIX Fortran "unformatted" layout
that has four-byte record lengths in the data.
If the customer needs more info, let me know.
Steve
|
| Again, if they have control over the VMS application, they can make things
much easier for themselves by using CONVERT='BIG_ENDIAN' (or 'LITTLE_ENDIAN' as
appropriate). The customer won't be able to access the URL I cited - you
can extract the file and mail it to them if they want it.
Steve
|