- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider a pair of simple programs like these:
(A rather silly set of programs, but it does seem to work in the sense that we get out the data we wrote in.)
We would like to be able to write this data on Linux and read the data on VMS. But it seems that RMS "gets in the way" when we try to move the file to VMS. Is there a set of file attributes or other magic that will make the file such that the same (or a similar) program will read the file on VMS?
Thanks.
P
program test_write
! Test reading and writing interchange between VMS and UNIX
! Write an upper triangular array where the array value is the column number
!
integer lun/1/
integer i, j
parameter (N=10)
real*4 x(N)
real*4 A /10/
real*8 B /20/
open (lun, file='test.dat',status='new',form='unformatted')
write (lun) i
write (lun) A, B
do i=1,N
x(i) = i
do j=1,i
write (lun) x(1:j)
enddo
enddo
stop
end
program test_read
! Test reading and writing interchange between VMS and UNIX
! Write an upper triangular array where the array value is the column number
!
integer lun/1/
integer i, j
parameter (N=10)
real*4 x(N)
real*4 A /10/
real*8 B /20/
open (lun, file='test.dat',status='old',form='unformatted')
read (lun) i
print *, i
read (lun) A, B
print *, A, B
do i=1,N
do j=1,i
read (lun) x(1:j)
enddo
print *, i, x(1), x(i)
enddo
stop
end
(A rather silly set of programs, but it does seem to work in the sense that we get out the data we wrote in.)
We would like to be able to write this data on Linux and read the data on VMS. But it seems that RMS "gets in the way" when we try to move the file to VMS. Is there a set of file attributes or other magic that will make the file such that the same (or a similar) program will read the file on VMS?
Thanks.
P
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this. On Linux, open the file for write using RECORDTYPE='SEGMENTED'. Copy the file to VMS using a "binary" file transfer method. Once on VMS, do this:
$ SET FILE /ATTRIBUTES=(RFM=VAR) file.dat
Now you should be able to open the file on VMS using RECORDTYPE='SEGMENTED' (which is the default for sequential unformatted files there).
What may be easier is if you know the records are all the same length, then use RECORDTYPE='FIXED' with the appropriate RECL value. Copy the file to VMS and do:
$ SET FILE /ATTRIBUTES=(RFM=FIX,LRL=72) file.dat
where the "72" is the actual length in bytes of the record. Remember that RECL= is in 4-byte "longword" units by default on both systems. Read the file as fixed records.
$ SET FILE /ATTRIBUTES=(RFM=VAR) file.dat
Now you should be able to open the file on VMS using RECORDTYPE='SEGMENTED' (which is the default for sequential unformatted files there).
What may be easier is if you know the records are all the same length, then use RECORDTYPE='FIXED' with the appropriate RECL value. Copy the file to VMS and do:
$ SET FILE /ATTRIBUTES=(RFM=FIX,LRL=72) file.dat
where the "72" is the actual length in bytes of the record. Remember that RECL= is in 4-byte "longword" units by default on both systems. Read the file as fixed records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's another approach. Simply copy the file as you are already writing it on Linux to VMS and then run the attached program on it to convert it to a 'SEGMENTED' file that the VMS Fortran will read directly. Caveat: I wrote this code 11 years ago and can't promise that it still works.
![](/skins/images/8B6E2C8F64F54CBD7F7262AA46F575DA/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page