Community
cancel
Showing results for 
Search instead for 
Did you mean: 
pweic
Beginner
120 Views

UNIX to PC

I am currently working on my final year project related to fortran 77.

I encounter some binary (sequential) files created by Fortran 77 in UNIX system, I try to read the file using my Compaq Visual Fortran 6.1A in PC but there are always error while reading the file.

As I do not have access to UNIX system, is there any way for me to convert the file to a text file in pc or read it using fortran 77 in pc?

Thank you for your help
0 Kudos
6 Replies
pweic
Beginner
120 Views

Ops, I think I made some mistake.

What I really mean is how to convert a fortran 77 binary file created in UNIX system to a text file or Fortran 77 binary file for Window 98.
Steven_L_Intel1
Employee
120 Views

Which UNIX system? Which Fortran 77 on UNIX? Most UNIX Fortran compilers create unformatted files in a method that is compatible with that used by Visual Fortran, but if the UNIX system is "big-endian" (Sun, IBM, HP, SGI), you'll need to open the file with CONVERT='BIG_ENDIAN' to do the length and data conversion.

Steve
pweic
Beginner
120 Views

Thanks Steve, in fact I'm not 100% sure this is the source of the problem. The following is the error I get:

cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

forrtl: severe <257>: formatted I/O to unit open for unformatted transfers, unit 20, file d:@fypTPXO.5h_TPXO.T.1.ot
Image pc routine line source
program1.exe 00409b79 unknown unknown unknown
...
...
kernel32.dll bff7b9e4 unknown unknown unknown
kernel32.dll bff7b896 unknown unknown unknown
kernel32.dll bff7a24f unknown unknown unknown

Stack trace terminated abnormally

Incrementally linked image--PC correlation disabled.

cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

I tried to use "form=formatted" to open the file, there was no error but I could only saw those binary symbols.
Steven_L_Intel1
Employee
120 Views

This has nothing to do with the file. Your Fortran code is doing formatted I/O to the unit, but you want unformatted. Remove the format specifier.

Steve
pweic
Beginner
120 Views

Thanks Steve. I got it now, that's quite stupid i think.

So when will I know that the unformatted sequential file can't be open by CONVERT='NATIVE' ? Cos I keep getting forrtl <22> now, but even if I set the recl = a very big number like 60000000, i still get the error.
Steven_L_Intel1
Employee
120 Views

You have to know what system wrote the file and whether it is compatible with PCs and CVF. I don't know of any automatic way to find out.

Steve
Reply