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

fortran error handling

roddur
Beginner
565 Views
Hello,
one more superfluous question. I need some suggestions on error
handling of a moderate size code(~3000 line).
In my code, i have already done error handling in file opening, human
error etc. But arithmatic error and other part is to be done. can you
give me some points to check when I try to check errors ?


one more question.

[plain]open(19,file="err.log")
......
open
(11,file=ASMAP,status='old',IOSTAT=ios,form='unformatted',iomsg=ermsg)

        if(ios/=0)then
        write(*,*) ios
        write(19,*) trim(ermsg)
.......
close(19)
[/plain]

writes the output on fort.19 (i am in linux) and not in err.log as
intended. why?

0 Kudos
1 Reply
Steven_L_Intel1
Employee
565 Views
Since you have paraphrased an excerpt of the code and not shown anything complete, all I can guess is that the actual code does not resemble the paraphrase. At the time you're doing the WRITE to unit 19, unit 19 would appear to be not open. You can use INQUIRE to test whether or not the unit is open and debug the program to see if the OPEN is actually being executed.

My further advice is to try to cut down the program to the minimum that reproduces the problem - you'll almost certainly find the error in that process.
0 Kudos
Reply