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

Forrtl: List Directed I/O Syntax Error

Ashwin_D_
Beginner
4,269 Views

Hello,

               After successfully compiling this code - https://software.intel.com/en-us/comment/1798317#comment-1798317 (thanks to Tim Prince) when I run this I get the error below. I know there is nothing with the data. So I am enclosing the f90 file and maybe somebody can help me what is the error with it.

Regards,

Ashwin.

program geogrid
      use iso_c_binding
      implicit none
      integer :: j
      integer :: isigned, endian, wordsize
      integer :: nx, ny, nz
      real :: scalefactor
      real*8 :: xllcorner, yllcorner, cellsize, missvalue
      character :: head12
      real, allocatable :: rarray(:,:), iarray(:,:)
      character(len=255) :: pathToFile
      LOGICAL :: file_exists

      isigned = 1
      endian = 0
      wordsize = 4
      scalefactor = 1.0
      nz = 1

      CALL getarg(1, pathToFile)

      INQUIRE(FILE=pathToFile, EXIST=file_exists)
    
      if (file_exists .eqv. .FALSE.) then
        write(0,*) "ERROR: no valid path to  *.asc SRTM file"
        CALL exit(-1)
      end if
      
      open (10, file = pathToFile)

      read(10,*) head12, nx
      read(10,*) head12, ny
      read(10,*) head12, xllcorner
      read(10,*) head12, yllcorner
      read(10,*) head12, cellsize
      read(10,*) head12, missvalue

      allocate(rarray(nx,1))
      allocate(iarray(nx,ny))

      do j = 1,ny
      read(10,*) iarray(:,j)
      end do

      ! reverse the data so that it begins at the lower-left corner
      do j = 1,ny/2
        rarray(:,1) = iarray(:,ny-(j-1))
        iarray(:,ny-(j-1)) = iarray(:,j)
        iarray(:,j) = rarray(:,1)
      end do
      deallocate(rarray)
        
      call write_geogrid(iarray, nx, ny, nz, isigned, endian, scalefactor, wordsize)

end program geogrid

 

forrtl: severe (59): list-directed I/O syntax error, unit 10, file /home/an/test/geogrid/./N13E079.hgt
Image              PC                Routine            Line        Source             
ConvSRTM           000000000041ABAA  Unknown               Unknown  Unknown
ConvSRTM           0000000000402826  Unknown               Unknown  Unknown
ConvSRTM           0000000000402386  Unknown               Unknown  Unknown
libc.so.6          00007F1F051A9EC5  Unknown               Unknown  Unknown
ConvSRTM           0000000000402269  Unknown               Unknown  Unknown

 

0 Kudos
3 Replies
Ashwin_D_
Beginner
4,269 Views

I think I figured this one out by adding -traceback to the compilation options.

0 Kudos
mecej4
Honored Contributor III
4,269 Views

Even though you solved the problem yourself, there is another useful conclusion that can be drawn. You stated, "...I know there is nothing with the data. So I am enclosing the f90 file...". However, you did not show us the data file, and your second post indicates that the problem was, in fact, with the contents of the data file.

0 Kudos
Ashwin_D_
Beginner
4,269 Views

Well the data file is any SRTM .hgt file. This FORTRAN file is looking for ASCII input but the input files I supplied  are all binary. Hence this will not work.

0 Kudos
Reply