Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29244 Discussions

Recursive I/O operation issue when calling inquire

Sebastien_D_
Beginner
815 Views

I encounter an issue when calling "inquire" statement on one file and reading another one. Here is an example :

program test
  implicit none
  character(100)        :: fdata, fresult, dummy
  integer               :: uin, uout
  logical               :: i_opened
 
  fdata = "datatest.dat"
  fresult = "resultest.dat"
 
  open (newunit = uin, file = fdata, form='formatted', status = 'old')
  inquire(FILE=fresult, OPENED=I_OPENED, NUMBER = uout)
 
  read(uin,*) dummy
endprogram test

When I run that program, there is the following error :
severe (40): recursive I/O operation, unit -129 file unknown

This problem can be solved by placing the "inquire" statement before opening the fdata file, but i don't understand why. Can anyone explain this to me ?

0 Kudos
3 Replies
Steven_L_Intel1
Employee
815 Views

This was a bug with NEWUNIT and was fixed some time ago. It works in the current release.

0 Kudos
Sebastien_D_
Beginner
815 Views

Steve,

Thank you for your answer. Do you know which update fixed this bug ?

0 Kudos
Steven_L_Intel1
Employee
815 Views

I am not sure (I am away from the office and don't have access to our issues database), but from a review of the Readmes, it looks as if it was 2013 SP1 Update 3.

0 Kudos
Reply