- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I`d like to convert real(kind=4) numbers from a file created on VAX computer to IEEE format. I found the LibVAXData library. It works correctly in a Win32 Fortran program, but gives incorrect results if I try to use it in a Win64 program. Has anybody tried to port the LibVaxData library for 64 bit environment?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran provides a much simpler way of reading unformatted files containing VAX real numbers: use the CONVERT='VAXD' or CONVERT='VAXG' clause, as appropriate, in the file OPEN statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I ma ware that feature. The file I need to read is a fixed record length file, which contains a mixture of integer and real numbers. I believe I need to use conversion routines on specific elements of a record. I was hoping that somebody solved this problem either in FORTRAN or compiling the LibVAXData library in a 64 bit environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
tkibedi wrote:
The file I need to read is a fixed record length file, which contains a mixture of integer and real numbers. I believe I need to use conversion routines on specific elements of a record.
I don't see why you need to do that. Here is an example in which we write a file with fixed length records. Each record contains an integer, followed by two real numbers in VAX-G floating format. Here is the program to write the file.
program tstw open(11,file='vaxg.dat',form='unformatted',convert='vaxg',status='replace') do i=1,100 x=sin(i*0.01) write(11)i,x,3*x end do close(11) end
Here is the program to read that file. If the program works correctly, columns 2 and 3 should match, as should columns 4 and 5.
program tstr open(11,file='vaxg.dat',form='unformatted',convert='vaxg',status='old') do i=1,100 read(11)j,y,z x=sin(i*0.01) write(*,'(i3,2x,4ES15.7)')j,x,y,3*x,z end do close(11) end
As long as you know the number and types of variables in each record of an existing unformatted Fortran file, you should be able to read such a file in a similar way, even if the record lengths are not all the same.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page