c**********************************************************************c
c  Description: Basic test to show that standard Fortran i/o works.
c
c  Bug:     1667
c  Author:  J. Czechowski IV / Neon Ngo
c  Version: $Id: test_fortran_io.for,v 1.3 2009/07/17 18:11:11 ntn Exp $
c**********************************************************************c
        program TEST_FORTRAN_IO
        implicit none
        include 'primitive.inc'
        include 'assert.inc'
        character*80 str
        character*80 tmp
        record/header/ hcb
        integer*4 len
        integer*4 ios
        integer*4 count
        integer*4 sta

        call M$CHECKIN
        call ASSERT_AUTOINIT('DEBUG','STAT')

        call M$SYNC

        Mu.verbose = M$GET_SSWITCH('VERBOSE')
        hcb.file_name = 'airports.csv'
        call m$existence(hcb, -2)
        len = m$length(hcb.file_name)

        if (Mu.verbose) write(*,*) 'file_name = ',hcb.file_name(1:len)

        open(unit=8,status='OLD',file=hcb.file_name(1:len),iostat=ios)
        if (Mu.verbose) write(*,*) 'test_fortran_io: START ios=',ios
        if (ios .ne. 0) then
          write(*,*) 'Error opening file: ',hcb.file_name(1:len)
        endif

        count = 0
        do while (ios .eq. 0)
          read(8,*,iostat=ios) str
c          read(8,*) str
          if (ios .eq. 0) then
            len = m$length(str)
c            write(*,*) 'test_fortran_io: read ',str(1:len)
            count = count + 1
          else
            write(*,*) 'test_fortran_io: ios=', ios
          endif
        enddo
        close(unit=8)

        if (Mu.verbose) then
          write(*,*) 'test_fortran_io: DONE count=', count
          write(*,*) ' '
        endif
        call ASSERT('Testing Fortran IO (read count>0)',(count .gt. 0))

        call M$RETURN
        call ASSERT_AUTOREPORT()
        end

c**********************************************************************c
c       Include assertion facility.
c**********************************************************************c
        include 'assert.for'
