Writing different output files in PG fortran unix

Hi all,
I recently transferred the code from windows visual fortran to PG fortran in unix. I am writing many output files. Logical unit number for each file is automatically generated. When I run the program, some files are getting written and some are not. When I debugged the code and forced the unit number as some other number like 2, 3, 4 and like that, the program seems to write. But when the numbers are like 800, 900 like that, the file is getting opened but no information is written to the file.
I could not find any information on logical unit number limitation.

Can any one provide some clue as why this is happening?

Thanks
Venkat

Hi Venkat,

Can any one provide some clue as why this is happening?

The only thing I can think of is that you have too many files open. You can only have 1024 open at any given time. Other than that I’m not sure. Can you provide a small example code showing what you are doing?

  • Mat

Hi Mat,
Thanks for the information. I don’t have too many files opens. I have approximately 25 output files and 10 inputs files. But 25 output files get file unit number assigned randomly. The program opens all output file names in the output direectory. But some of them are empty. As I said before, If I change the file unit number to say 2, model writes data to the output file.
Is there any upper limit on the logical unit number.

I tranferred this code from Visual Fortran for Intel. I did not have this problem in Intel or Compaq.

Thanks
Venkat

Hi Venkat,

Is there any upper limit on the logical unit number.

The only constraint is that the unit needs to be a non-negative integer. So a unit of 800 shouldn’t be a problem. Something else is going on. Can you post an example or send it to PGI Customer Support (trs@pgroup.com)?

Thanks,
Mat