Can't Write to Exabyte Tape From FORTRAN (Repost)

Mike Mitchell mitchell at turing.chem.uh.edu
Fri Aug 17 00:28:13 AEST 1990



    I'm having problems writing to an Exabyte 8mm tape drive from a FORTRAN
 program.  I can read the tape just fine, but can't seem to write to it.
 The following code runs fine, seems to open the file, etc., but doesn't 
 actually write.  When writing, the tape doesn't move or act as if it is
 connected at all.  The REWINDs work fine, though, and the tape shows
 activity.  Is there a special character I have to send to flush a buffer?
 I would have thought the CLOSE() statement would have done this?

 Any suggestions appreciated

 Mike Mitchell
 Department of Chemistry
 University of Houston
 
      PROGRAM TESTOPEN
C
      character*10 cacc,cform,cseq,cunfo
      character*15 cname
      logical lopen,lexist
c
      inquire(file='/dev/tape8',access=cacc,exist=lexist,form=cform,
     +                            iostat=ierr,name=cname,opened=lopen,
     +                            sequential=cseq,unformatted=cunfo)
      write(6,'(4a,l1,3a,i5,/,3a,l1,4a)') ' after first inquire:',
     +                   'access=',
     +                 cacc,'exist=',lexist,' form=',cform,' iostat=',
     +                   ierr,' name=',cname,' opened= ',lopen,
     +                   ' sequential=',cseq,' unformatted=',cunfo
c
      OPEN(UNIT=9,STATUS='UNKNOWN',FILE='/dev/tape8',FORM='FORMATTED',
     +            IOSTAT=ierr,ACCESS='SEQUENTIAL')
c
      inquire(file='/dev/tape8',access=cacc,exist=lexist,form=cform,
     +                            iostat=ierr,name=cname,opened=lopen,
     +                            sequential=cseq,unformatted=cunfo)
      write(6,'(3a,l1,3a,i5,/,3a,l1,4a)')
     +                   ' after second inquire: access=',
     +                 cacc,'exist=',lexist,' form=',cform,' iostat=',
     +                   ierr,' name=',cname,' opened= ',lopen,
     +                   ' sequential=',cseq,' unformatted=',cunfo
C
      write(6,'(a)') ' About to rewind the tape.'
      rewind(9)
      write(6,'(a)') ' About to write to the tape.'
      write(9,'(a)',iostat=ierr) 'Hello world.'
      write(6,'(a,i5)') ' Written to tape, iostat =',ierr
c
      do 20 i = 1,100
         write(9,'(a,i5)',iostat=ierr) ' Writing line # ',i
         write(6,'(a,i5,a,i5)') ' Writing line ',i,' ierr =',ierr
  20  continue
c
      write(6,'(a)') ' About to rewind the tape.'
      rewind(9)
      CLOSE(UNIT=9)
      write(6,'(a)') ' All done writing and closing.'
C
C
      STOP
      END



More information about the Comp.sys.sgi mailing list