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

forrtl: severe (67): input statement requires too much data

shivali_g_
Beginner
1,006 Views

forrtl: severe (67): input statement requires too much data, unit 13, file /gpfs4/home/alodh/OUTPUT/SNOW_DATA/Surf_SnowLat.dat
Image              PC                Routine            Line        Source
SurfProg_Snow.exe  00000000004BF720  Unknown               Unknown  Unknown
SurfProg_Snow.exe  00000000004BD005  Unknown               Unknown  Unknown
SurfProg_Snow.exe  000000000041808D  surf_snow_latlong          87  Surf_Snow_LatLonGrid.f90
SurfProg_Snow.exe  0000000000410732  MAIN__                    384  SurfProg_Snow.f90
SurfProg_Snow.exe  000000000040DBF6  Unknown               Unknown  Unknown
libc.so.6          00002AC427119CDD  Unknown               Unknown  Unknown
SurfProg_Snow.exe  000000000040DAE9  Unknown               Unknown  Unknown

 

0 Kudos
6 Replies
jimdempseyatthecove
Honored Contributor III
1,006 Views

Can you show the code around line 87 of Surf_Snow_LatLonGrid.f90 and specify what you know about the variables and data?

Compiler options may be helpful too.

Jim Dempsey

0 Kudos
mecej4
Honored Contributor III
1,006 Views

Shivali G.: Please understand that it is extremely unlikely that anyone can tell you how to fix I/O errors when you have not shown us even a single line of the program source or the data.

Were it otherwise, perhaps we could simply beg The Donald to fix the problem once and for all and send the bill to Mexico :) .

0 Kudos
FortranFan
Honored Contributor II
1,006 Views

@Shivali,

Just noticed a post on another forum similar to yours and it has me wondering. 

Can you provide some background on what you're trying to do?  Is this toward a programming course where you have to do some Fortran coding?  Or as part of some other technical course where the instructor has specifically asked you to code in Fortran?  Or in some research/job where the supervisor has instructed Fortran? 

If you're doing some data analysis and if it is one-off, meaning you're not developing an algorithm toward a (larger) program that may use the method(s) repeatedly, then you'd be better doing all such "computing" in other ways such as spreadsheets (Excel), math packages (MATLAB/Octave), or interpreted languages (Python) rather than in Fortran. 

But given your posts where you just throw a problem out there and hoping to get a "free" answer, I feel the etiquette calls for you to provide your background and show what you're doing to do help yourself.  Please be honest.  

0 Kudos
shivali_g_
Beginner
1,006 Views


Hi,

 

+++++++++++ Surf_Snow_LatLonGrid.f90 +++++++++++++++++++++++

74 ! Open Latitude file and read latitudes
 75 !----------------------------------------------------------------------
 76
 77 Write(6,*) '  '
 78 Write(6,*) 'Reading IMS latitudes from file'
 79
 80 LExist=.TRUE.
 81 LFormatted=.FALSE.
 82 LReadWrite=.FALSE.
 83
 84 CALL Surf_General_Openfile(LatFile_env,Lat_FileUnit,    &
 85                             Lexist,Lformatted,Lreadwrite)
 86 !  Write(6,*) 'Shivali insite latlon '
 87 Read(Lat_FileUnit) Lat(:)
 88
 89 If (GeneralMode >= VerboseMode) Then
 90   Write(6,*) 'First 10 latitudes are ', Lat(1:10)
 91 End If
 +++++++++++++++++++++++++++++++++++++++++++++++
Surf_General_Openfile.f90 -
+++++++++++++++++++++++++++++++++++++++++++++++
124   WRITE(6,*) 'Opening dataset on unit ',NFT
125
126   WRITE(6,*) 'Shivali ---- LFormatted ---', LFormatted
127   WRITE(6,*) 'Shivali ---- LReadWrite ---', LReadWrite
128
129   IF(LFormatted.AND.LReadWrite) THEN
130     OPEN(NFT,file=CFile_Name,form='FORMATTED',ACTION='READWRITE')
131   ELSEIF(LFormatted.AND..NOT.LReadWrite) THEN
132     OPEN(NFT,file=CFile_Name,form='FORMATTED',ACTION='READ')
133   ELSEIF(.NOT.LFormatted.AND.LReadWrite) THEN
134     OPEN(NFT,file=CFile_Name,form='UNFORMATTED',ACTION='READWRITE')
135   ELSEIF(.NOT.LFormatted.AND..NOT.LReadWrite) THEN
136     OPEN(NFT,file=CFile_Name,form='UNFORMATTED',ACTION='READ')
137   ENDIF
138
139 ELSE
140
141   WRITE(6,*) 'Dataset already open'
142
143 ENDIF
144
145 IF (UseTrace) CALL Gen_TraceExit(RoutineName)
146
147 RETURN
148 END SUBROUTINE Surf_General_OpenFile

 

 

 

0 Kudos
shivali_g_
Beginner
1,006 Views

tried error handling as suggested in previous post - 

++++++++++++++++++++

CALL Surf_General_Openfile(LatFile_env,Lat_FileUnit,    &
                            Lexist,Lformatted,Lreadwrite)
lno = 0
loop_red: do

Read(Lat_FileUnit, iostat=ist, iomsg=errio) Lat(:)

write(6,*)'Shivali iostat iomsg ------', ist, errio
select case ( ist )
 case ( 0 )

      !.. successful; can introduce debug printing of read line
      !here
 case ( iostat_end )
      !.. End of file reached
      write(6,*)'Number of lines read = ',lno
      close(unit=Lon_FileUnit, iostat=ist, iomsg=errio)
           if (ist /= 0) then
               write(6,*) " error opening file: "
           end if
       exit loop_red
 case default
      !.. Error condition
      write(6,*)'Error reading line ',lno+1,', iostat = ',ist
end select
lno = lno + 1
 end do loop_red


+++++++++++++++++++++++++++++++

OUTPUT coming out as -

 Shivali iostat iomsg ------          67
 input statement requires too much data, unit 13, file /gpfs4/home/alodh/OUTPUT/
 SNOW_DATA/Surf_SnowLat.dat


 Error reading line                      1 , iostat =           67
 Shivali iostat iomsg ------          39
 error during read, unit 13, file /gpfs4/home/alodh/OUTPUT/SNOW_DATA/Surf_SnowLa
 t.dat


 Error reading line                      2 , iostat =           39
 Shivali iostat iomsg ------          -1
 end-of-file during read, unit 13, file /gpfs4/home/alodh/OUTPUT/SNOW_DATA/Surf_
 SnowLat.dat


 Number of lines read =            2


========================================

 

0 Kudos
mecej4
Honored Contributor III
1,006 Views

Line 87 of #5 contains  Read(Lat_FileUnit) Lat(:). For this to work, the file has to be a Fortran unformatted file, and Lat has to be a properly declared variable whose size must match the size of the record in the file. If the variable Lat is a pointer or an allocatable array,  and it has not been allocated, or the allocation size is less than the size computed from the 4-byte record descriptor in the file, the READ could fail. similarly, if the declared size of the array is larger than the size of the data array in the file record, an error will occur.

In your program, the second situation is more probably the one that occurred. We have no idea what is in the file. If you can show the first 16 bytes of the file contents, using a hex-dump program or binary file viewer such as bvi, and show us the declaration(s) of the variable Lat, perhaps we can help.

Once more, you are asking us to help you without providing us all the necessary information; if you do not grasp what needs to be included in "necessary information", you need to read and work through Fortran manuals and tutorials to rectify that.

0 Kudos
Reply