[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | Digital Fortran |
Notice: | Read notes 1.* for important information |
Moderator: | QUARK::LIONEL |
|
Created: | Thu Jun 01 1995 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 1333 |
Total number of notes: | 6734 |
1214.0. "UNIX data file slightly different from VMS data file, same code" by PEACHS::DALEY (Maybe I should drink more coffee...or less!) Thu Mar 06 1997 15:05
Hi,
Explaination first, sample code at the end.
Customer writes a value (unformatted) to a file in a fortran program on
unix. ftp's or copies that file to VMS, and the same program there
can't read the data. He notices two things:
- The same data written on VMS has a different hex value in the files.
- If he ftp's the file over from unix, the values are transposed
little/big endian stuff, I suppose. That's for another conference.
The question for this conference is: Why are the values different in the
two files, and does it matter? For instance, the value written for
.98675 on unix dumps out like this:
od -h xxx.fil
0000000 9ba6 3f7c
0000004
But on VMS, the file written looks like this:
Dump of file $1$DUA1:[DALEY]XXX.FIL;2 on 6-MAR-1997 14:41:04.84
File ID (2415,1,0) End of file block 1 / Allocated 3
Record number 1 (00000001), 4 (0004) bytes, RFA(0001,0000,0000)
9BA6407C |@�............. 000000
3f7c becomes 407c. Why is that?
Any insight is appreciated.
Regards,
John
Here's the sample program:
program xxx
implicit none
structure /stats/
union
map
real*4 null_time
end map
end union
end structure
record /stats/ stats_rec
open ( access = 'sequential',
1 carriagecontrol = 'list',
1 dispose = 'save',
1 file = 'xxx.fil',
1 status = 'new',
1 unit = 6,
1 shared,
1 recordtype='fixed',
1 form='unformatted',
1 recl=1 )
stats_rec.null_time = .98675
write (unit=6) stats_rec
close ( unit=6, dispose='save' )
end
T.R | Title | User | Personal Name | Date | Lines |
---|
1214.1 | | QUARK::LIONEL | Free advice is worth every cent | Thu Mar 06 1997 15:13 | 21 |
| Different datatypes. VMS uses F_float as the default for real*4, UNIX uses
IEEE. On Alpha, you can compile /FLOAT=IEEE to make it be the same. On VAX,
it's a bit tougher because you used a RECORD - if you had just used a
regular variable, or a record field, you could open with
CONVERT='LITTLE_ENDIAN'.
$ fort/float=ieee t
$ link t
$ run t
$ dump xxx.fil
Dump of file USER_DISK:[LIONEL]XXX.FIL;1 on 6-MAR-1997 15:09:31.97
File ID (17343,22,0) End of file block 1 / Allocated 4
Virtual block number 1 (00000001), 512 (0200) bytes
00000000 00000000 00000000 3F7C9BA6 �.|?............ 000000
Note that because you used od -h on UNIX, it dumps in word order.
Steve
|