Problems reading Fortran binary data files 
Author Message
 Problems reading Fortran binary data files

I am having problems reading data files created by a fortran program
(believe written in Lahey Fortran ). The files are supposedly binary,
unformatted, sequential files. I wrote a simple Fortran program using
Microsoft Powerstation Fortran using every combination of OPEN & READ
statements I can think of but the values I am getting are mostly garbage. (I
have a test case run several years ago so I know what the output should be).
The Microsoft documentation suggests using a routine called unfseq to
convert binary data files not written in Powerstation Fortran, but all I get
are read errors or illegal operation errors. I know the format of each
record (integers, characters and numeric data) but apparently there are
other characters written to the file I am not aware of and Microsoft
Powerstation doesn't recognize).

Does anyone have any ideas as to how to read these files? Would a program to
read these files written in Lahey Fortran be "more" compatible with the data
files?



Fri, 20 Feb 2004 01:33:26 GMT  
 Problems reading Fortran binary data files

Quote:
> I am having problems reading data files created by a Fortran program
> (believe written in Lahey Fortran ). The files are supposedly binary,
> unformatted, sequential files.

If this was Lahey Fortran 90 (LF90), and not the newer Lahey/Fujitsu Fortran
95 (LF95), the file is in a compiler-specific format.  LF95 changed to use
the UNIX-style layout that the PowerStation UNFSEQ program likes.

Some time ago, I wrote a program for Digital (now Compaq) Visual Fortran
that reads LF90 files and converts them to the CVF-style, which is the same
"UNIX-style" I referred to above.  I think it would work in PowerStation
too, just change the USE DFLIB to USE MSFLIB. (But I haven't tested this.)
Get it from http://www.compaq.com/fortran/examples/cvt_lf_unf.f90  You'll
then end up with a file you can run through UNFSEQ.

--
Steve Lionel
Compaq Fortran Engineering
http://www.compaq.com/fortran



Fri, 20 Feb 2004 02:37:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Reading a binary file / writing binary data to a file

2. Problem reading binary data file

3. Problem reading a binary file in fortran

4. Fortran Data Input Problem-sample data and READ stmt

5. Fortran/C code to read LV binary data?

6. Using DEC Fortran to read raw binary data?

7. help reading fortran generated binary data...

8. Reading a binary data set created by SAS into FORTRAN

9. Read the fortran unformatted binary data.

10. PROBLEM: Binary file reading problems

11. PROBLEM: Binary file reading problems

12. Reading binary double floats from an old data file

 

 
Powered by phpBB® Forum Software