PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Recordtype='fixed'
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
JCT_FORTRAN



Joined: 20 Mar 2014
Posts: 4

PostPosted: Wed Apr 02, 2014 7:53 am    Post subject: recordtype='fixed' suggestion did not work Reply with quote

Thanks for the suggestion, but that did not work.

open(unit=47,file='foo',form='unformatted', status='old', access='direct', recl=5, readonly, iostat=ierr, err=99, iomsg=message)

read(47,iostat=jerr, err=99, iomsg=message2) k1, k2, k3, k4, k5

My open statement worked fine. But on the first read, I get an iostat error code = 219, iomessage = 'attempt to read/write past end of record'

Here is what I suspect is happening. The open statement is defaulting to a variable length record. (The old equivalent of recordtype='variable'). As such, the read statement is expecting the first word in the record to be the record length. But since the file was created as a true fixed length record, no such information is obtained. (Or, more precisely, the read statement picks up an erroneous record length obtained from the first variable in the read.)

I must say, reading and writing fixed length records should be pretty standard stuff.

Any help will be appreciated.
Back to top
View user's profile
JCT_FORTRAN



Joined: 20 Mar 2014
Posts: 4

PostPosted: Wed Apr 02, 2014 9:03 am    Post subject: Reply with quote

I think I found it. Recl needs to be number of bytes, not number of long-words.

With this change, my code now seems to work.

Thanks to all who tried to help.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group