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

Handling read errors

rzamudio
Beginner
334 Views
I am new toFortran andworking with an application thatreads input files using a large number of read statements with the following form:
READ (5,*)input1, input2, ... , inputN
The problem is that if there is an error in the input files, I get a Fortranrun-time error that opens a message window. I would like to suppressthe message windowand exit the application with an error code in the case of input file errors. Because of the size of the code, I would like to avoid having toadd "ERR=" to every read statement.
I tired using the SETERRORMODEQQ(.FALSE.) function fromthe IFPORT library, but it does notprevent themessage window from opening. Is there a way to suppress error windows from the run-time without modifying the read statements?
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
334 Views
I'd prefer inserting IOSTAT= or ERR= statements, but you can try your luck with calling

lret = SETENVQQ("FOR_DISABLE_DIAGNOSTIC_DISPLAY=TRUE")

somewhere at the start. If it fails, try setting that environment variable on the system level.
0 Kudos
rzamudio
Beginner
334 Views
Thanks, this seems to work for whatI am doing. I agree that IOSTAT= or ERR= for each read statement is a better way to handle the errors. I willuse this approach for future development.
0 Kudos
Reply