Fortran code error: forrtl: severe (66)

In summary: But "output statement overflows record" seems to indicate a write is trying to produce too many characters for the given record size.In summary, a user with limited knowledge of Fortran has been tasked with debugging old Fortran code that was originally written in the mid 1970's. The code has been adapted over the years and last ran successfully in 2009, but has now been deemed obsolete. Despite being a beginner in Fortran, the user has managed to recompile the code using Visual Fortran and MS Development Studio. However, when running certain executables, an error is encountered regarding output to unit 10. The user has attempted to debug the code and has deduced that the issue could be related to input/output commands or calls
  • #1
nox13
4
0
Hi everybody,

I have old Fortran code, originally written in the mid 1970's for an Elmer system. The code has been adapted through the years, last run successfully in 2009.

The code has now landed on my lap after having been "retired" due to obsolescence. I am a pure Fortran beginner.

I have managed to recompile everything using Visual Fortran and MS Development Studio. However, when running certain executables I get the following error:


********************************************************
* EXECUTING GENERATE ! *
* *
* This program may be executed several times *
* *
********************************************************

1 file(s) copied.
Enter date - YYYYMMDD
20120404
forrtl: severe (66): output statement overflows record, unit 10, file C:\IMPALA2
\FATIMP1M


Is there anybody out there that can assist with solving this problem? If you need further information, please let me know.

Thanks in advance!
 
Technology news on Phys.org
  • #2
do YOU have any idea where the problem could be?
do you have the source code?
the part where it tries to write to unit 10?
have YOU trie to do ANY kind of debugging?
 
  • #3
Fortran... oh such memories...

Google does wonders in cases like this. Hope this helps:
http://www.hpc.unimelb.edu.au/doc/f90lrm/dfum_033.html
 
Last edited by a moderator:
  • #4
Thanks for the replies so far.

Using my limited knowledge and Google, I deduced that it could be one of 2 problems.

1) The input received (read command - type, length) did not match the output (write command - type length)

2) Calls to and from Unit 10 are invalid

I am starting to run through the code, line by line and trace where the calls come from and go to.

I have the source code available. The program compiles without any errors.
 
  • #5
Hi, nox13,
if I'm reading correctly the error list I linked to (and if I remember correctly),

my guess is that your program is trying to write a file in fixed-sized records (the record size being determined possibly by a "RECL" keyword in the open statement), and the "write" instruction is trying to write data that results in more bytes that the given record size.

Maybe posting part of your code would help (at least the opening of the file on unit 10, and the write statements on it).
 
  • #6
The code for the part of the program calling unit 10:

**************

OPEN MAIN FILE
OPEN(UNIT=10,FILE=mainfile,STATUS='OLD',ACCESS='DIRECT', !hl1
*recl=81,FORM='FORMATTED' ) !hl1
c *COUNTBY='RECORD',FORM='FORMATTED',IOSTAT=ISTAT)
C
C READ LAST DATE FROM MAIN FILE, INPUT DATE FROM CARDS, CALCULATE NO.
C OF DAYS BETWEEN RUNS
READ(10,900,REC=1)LDATE
NEXFLR=2
!sh01
! WRITE(6,*)' ENTER DATE - YYMMDD' !hl1
WRITE(6,*)' Enter date - YYYYMMDD'
!
READ(5,910)IDAY

NRUND = IDAYS(IDAY(1),IDAY(2),IDAY(3))
!sh01
! ldate=ldate
! NLASTD = IDAYS2(LDATE)
NLASTD = IDAYS(LDATE(1),LDATE(2),LDATE(3))
!
NUMDAY = NRUND - NLASTD

C WRITE NEW DATE TO SUMMARY FILE
WRITE(12,920)IDAY

*************
!sh1 refers to changes made to the code to account for Y2K.

The format are as follows:

*************

!sh01
!900 FORMAT(9X,I6)
!910 FORMAT(3I2.2)
!920 FORMAT(1X,3I2.2)
!930 FORMAT(55X,22('*')/55X,'LAST RUN DATE -',I7/55X,22('*')/'1')
900 FORMAT(9X,I4,2I2)
910 FORMAT(I4,2I2)
920 FORMAT(1X,I4,2I2.2)
930 FORMAT(55X,26('*')/55X,'LAST RUN DATE - ',I4,2('/',I2.2)/
+ 55X,26('*')/'1')

*****************
 
Last edited:
  • #7
Added [ code ] and [ /code ] tags to improve readability.
nox13 said:
The code for the part of the program calling unit 10:

**************
Code:
OPEN MAIN FILE [color="red"]<<< ---- this should be a comment[/color]
      OPEN(UNIT=10,FILE=mainfile,STATUS='OLD',ACCESS='DIRECT',		!hl1
     *recl=81,FORM='FORMATTED' )					!hl1
c     *COUNTBY='RECORD',FORM='FORMATTED',IOSTAT=ISTAT)
C
C READ LAST DATE FROM MAIN FILE, INPUT DATE FROM CARDS, CALCULATE NO.
C OF DAYS BETWEEN RUNS
      READ(10,900,REC=1)LDATE
      NEXFLR=2
!sh01     
!      WRITE(6,*)' ENTER DATE - YYMMDD'                                  !hl1
      WRITE(6,*)' Enter date - YYYYMMDD'
!      
      READ(5,910)IDAY
     
      NRUND = IDAYS(IDAY(1),IDAY(2),IDAY(3))
!sh01      
!      ldate=ldate
!      NLASTD = IDAYS2(LDATE)
      NLASTD = IDAYS(LDATE(1),LDATE(2),LDATE(3))
!       
      NUMDAY  = NRUND - NLASTD

C WRITE NEW DATE TO SUMMARY FILE
      WRITE(12,920)IDAY  [color="red"]<<< --- This code doesn't show unit 12 being opened[/color]

*************
!sh1 refers to changes made to the code to account for Y2K.

The format are as follows:

*************

!sh01
!900   FORMAT(9X,I6)
!910   FORMAT(3I2.2)
!920   FORMAT(1X,3I2.2)
!930   FORMAT(55X,22('*')/55X,'LAST RUN DATE -',I7/55X,22('*')/'1')
  900 FORMAT(9X,I4,2I2)
  910 FORMAT(I4,2I2)
  920 FORMAT(1X,I4,2I2.2)
  930 FORMAT(55X,26('*')/55X,'LAST RUN DATE - ',I4,2('/',I2.2)/
     +       55X,26('*')/'1')
*****************

It looks to me like the problem is the line where the code is attempting to write to unit 12, which might not have been opened.
 
  • #8
Thanks Mark44. I will implement where possible.

Debugging is slow but progressing.

Having a problem now with the \n carriage return command. This command seems to not be recognized by Digital Fortran...is there an alternative command that I can try? The / command doesn't change the format of the output either in this instance.

Apologies for the noob questions.
 
  • #10
Curiously enough, the error was about output to unit 10, which does not appear to relate to the piece of code you posted. Maybe the faulty code is somewhere forward - look for further writes to unit=10.

Also, I was thinking that a likely possibility for a program that was OK and now fails with this error, is that the variable sizes have changed. Maybe the "recl=81" assumed a certain integer size (16? 32 bits?) and now you are on a machine where integers are larger. When the program tries to write a bunch of those into one record... they won't fit anymore.

Without seeing the actual write(unit=10,...), it's just guessing, of course.
 

1. What does the "forrtl: severe (66)" error mean in Fortran code?

The "forrtl: severe (66)" error is a specific type of runtime error in Fortran that indicates a subscript or array index is out of bounds. This means that the program is trying to access a memory location that does not exist, often due to an incorrect array size or an error in the logic of the program.

2. How can I fix a "forrtl: severe (66)" error in my Fortran code?

To fix a "forrtl: severe (66)" error, you will need to carefully review your code and identify where the out-of-bounds error is occurring. This may involve checking your array dimensions, ensuring that all indices are within the appropriate range, and correcting any logical errors that may be causing the issue.

3. Can a "forrtl: severe (66)" error be caused by a syntax error in Fortran code?

Yes, a "forrtl: severe (66)" error can be caused by a syntax error in Fortran code. For example, if you have a typo in your array index or a missing comma or parenthesis, it can lead to an out-of-bounds error and trigger this specific runtime error.

4. Why am I getting a "forrtl: severe (66)" error even though my Fortran code compiled without any errors?

It is possible for your Fortran code to compile without any errors, but still encounter a "forrtl: severe (66)" error at runtime. This is because the compiler may not catch all potential out-of-bounds errors, and it is only during execution that the issue is identified and the error is triggered.

5. Are there any tools or techniques that can help me prevent "forrtl: severe (66)" errors in my Fortran code?

Yes, there are several tools and techniques that can help prevent "forrtl: severe (66)" errors in Fortran code. These include using debuggers to identify and fix errors during runtime, writing thorough test cases to catch potential issues, and using modern Fortran features such as array bounds checking to catch errors at compile time.

Similar threads

  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
17
Views
6K
  • Programming and Computer Science
Replies
4
Views
8K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
1
Views
2K
Back
Top