PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

fortran run time error

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling
View previous topic :: View next topic  
Author Message
kuldeep gupta



Joined: 11 Oct 2011
Posts: 41

PostPosted: Sat Feb 18, 2012 11:00 am    Post subject: fortran run time error Reply with quote

when we get this error

"PGFIO-F-217/formatted attempt to read past end of file"

& what can we do to eliminate this error

Please help me,
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6134
Location: The Portland Group Inc.

PostPosted: Mon Feb 20, 2012 2:37 pm    Post subject: Reply with quote

Quote:
what can we do to eliminate this error
All we know from this error is that your program tried to continue reading a file after it reach the end. What type of file is it trying to read? How is the file being accessed? What does your open statement look like? What format is the data? How was the file's data created?

Most likely your program is expecting the file to be in one format but it's in another.

- Mat
Back to top
View user's profile
zbeekman



Joined: 04 Apr 2012
Posts: 5

PostPosted: Wed Apr 04, 2012 11:15 am    Post subject: Reply with quote

If you're doing unformatted IO then Fortran will include record indicators, and an entire record is typically consumed by each read statement whether or not you request all the data.

Code:
OPEN(unit,file=myfile.dat, form='UNFORMATTED')
WRITE(unit) foo1, foo2, foo3
WRITE(unit) bar1, bar2, bar3
CLOSE(unit)

...

OPEN(unit,file=myfile.dat, form='UNFORMATTED')
READ(unit) foo1
READ(unit) foo2 ! This will likely be bar1, not foo2!
CLOSE(unit)


In the above example the two read statements will likely consume all the data written by the two write statements. In formatted files the newline character is the marker of the end of the record, so after each read statement the file will be positioned at the next line (unless the ADVANCE='NO' specifier is used.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling All times are GMT - 7 Hours
Page 1 of 1

 
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