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

forrtl: severe (66): output statement overflows record, unit -5, file Internal Formatted Write

GiorgioT
Novice
4,662 Views

Dear Intel community,
                                        I am running a simple simulation with KPP processor and after the 9th output .dat file (out of 150) the simulation terminates with the following error message:

 

forrtl: severe (66): output statement overflows record, unit -5, file Internal Formatted Write

Compiler used: Intel Fortran Compiler 2022.2.1 .

This might be the part of the Fortran code involved:

OPEN( unit=10, file="dyno_"//ex_no(1)//ex_no(2)//ex_no(3)//".dat")

...... ......

INTEGER i

WRITE(10,999) (TIME-TSTART)/3600.D0, &
(C(LOOKAT(i))/CFACTOR, i=1,NLOOKAT)

999 FORMAT(E24.16,100(1X,E24.16))*

 

I hope you can help with that.

 

 

Thank you in advance.

0 Kudos
1 Solution
GiorgioT
Novice
4,567 Views

Dear mecej4 and Markus, thanks a lot for your help. The compilation went successfully and the simulation is now running.

I apologize for this very simple question, I will dig into your answers to learn more as I am a beginner in Fortran scripting.

Cheers, Giorgio.

 

 

View solution in original post

0 Kudos
8 Replies
mecej4
Honored Contributor III
4,623 Views

I do not think that you are reporting the error correctly. The error message is about an internal write, with unit number -5. The WRITE statement that you display, on the other hand, is for an external write to unit number +10.

0 Kudos
Alina_S_Intel
Employee
4,603 Views

Refer to https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/compiler-reference/error-handling/run-time-errors/list-of-run-time-error-messages.html for more details about runtime errors.


Please, build your application with -g and -traceback to get more information about where exactly crash happens. I would recommend disabling optimizations using -O0 as well to make sure the issue is still reproducible with unoptimized code.


0 Kudos
GiorgioT
Novice
4,602 Views

Dear mecej4, 

                        you are right sorry. The following is the relevant part of the .f90 that I believe should be important and the key of the problem:


SUBROUTINE InitSaveData (j)

USE dynho_Parameters
INTEGER :: j
CHARACTER :: ex_no(3)

ex_no(1:2) = '000'


IF(j.lt.10) then
WRITE(ex_no(3),4) j
4 FORMAT(i1)
ELSEIF (j.ge.10.and.j.lt.100) then
WRITE(ex_no(2:3),5) j
5 FORMAT(i2)
ELSE
WRITE(ex_no(:),6) j
6 FORMAT(i3)
END IF

OPEN( unit=10, file="dynho_"//ex_no(1)//ex_no(2)//ex_no(3)//".dat")
! open(10, file='dynho.dat')

END SUBROUTINE InitSaveData

 

Something is wrong with WRITE(ex_no(2:3),5)  I guess!

 

Thank you very much for your help!!

0 Kudos
Arjen_Markus
Honored Contributor I
4,590 Views

Your declaration of the character variable has a mistake: ex_no is an array of three elements, each being a single character. You probably mean:

character(len=3) :: ex_no

and you can achieve this more easily with:

write( ex_no, '(i3.3)' ) j

then the zeroes are added automatically :).

GiorgioT
Novice
4,573 Views

Dear Markus,

                       thanks a lot for your help. I modified the subroutine this way:

 

SUBROUTINE InitSaveData (j)

USE dynho_Parameters
INTEGER :: j
CHARACTER(len=3) :: ex_no

WRITE(ex_no,'(i3.3)') j


OPEN( unit=10, file="dynho_"//ex_no(1)//ex_no(2)//ex_no(3)//".dat")

END SUBROUTINE InitSaveData

 

but I get a compilation error:

 

dynho_Util.f90(73): error #6410: This name has not been declared as an array or a function. [EX_NO]
OPEN( unit=10, file="dynho_"//ex_no(1)//ex_no(2)//ex_no(3)//".dat")
------------------------------------^
dynho_Util.f90(73): error #6054: A CHARACTER data type is required in this context. [EX_NO]
OPEN( unit=10, file="dynho_"//ex_no(1)//ex_no(2)//ex_no(3)//".dat")
------------------------------------^
dynho_Util.f90(73): error #6054: A CHARACTER data type is required in this context. [EX_NO]
OPEN( unit=10, file="dynho_"//ex_no(1)//ex_no(2)//ex_no(3)//".dat")
----------------------------------------------^
dynho_Util.f90(73): error #6054: A CHARACTER data type is required in this context. [EX_NO]
OPEN( unit=10, file="dynho_"//ex_no(1)//ex_no(2)//ex_no(3)//".dat")
-------

 

I guess because ex_no(1), ex_no(2), ex_no(3) are not arrays anymore, right?

 

Thanks a lot.

0 Kudos
mecej4
Honored Contributor III
4,570 Views

To match the change in the declaration of the variable ex_no (from an array of single characters to a scalar character variable of length 3), replace the expression ex_no(1)//ex_no(2)//ex_no(3) by ex_no .

0 Kudos
GiorgioT
Novice
4,568 Views

Dear mecej4 and Markus, thanks a lot for your help. The compilation went successfully and the simulation is now running.

I apologize for this very simple question, I will dig into your answers to learn more as I am a beginner in Fortran scripting.

Cheers, Giorgio.

 

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
4,563 Views

Giorgio,

>>I am a beginner in Fortran scripting.

For future reference, you can subscript a character variable that has a length larger than 1.

use VariableName(FirstIndex:LastIndex) = value

For example, the 2nd character of your ex_no variable is referenced with ex_no(2:2).

The 2nd and 3rd characters by ex_no(2:3), etc...

You can apply this information to other situations where you need to manipulate text. Also consult TRIM, ADJUSTL and ADJUSTR.

 

Jim Dempsey

Reply