Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

4.7.4 Binary Unformatted I/O

Opening a file with FORM=’BINARY’ has roughly the same effect as FORM=’UNFORMATTED’, except that no record lengths are embedded in the file. Without this data, there is no way to tell where one record begins, or ends. Thus, it is impossible to BACKSPACE a FORM=’BINARY’ file, because there is no way of telling where to backspace to. A READ on a ’BINARY’ file will read as much data as needed to fill the variables on the input list.

  • WRITE statement: Data is written to the file in binary, with as many bytes transferred as specified by the output list.

  • READ statement: Data is read into the variables on the input list, transferring as many bytes as required by the list. Because there are no record marks on the file, there will be no “end-of-record” error detection. The only errors detected are “end-of-file” or abnormal system errors.

  • INQUIRE statement: INQUIRE on a file opened with FORM=”BINARY” returns:

    FORM=”BINARY”ACCESS=”SEQUENTIAL”DIRECT=”NO”FORMATTED=”NO”UNFORMATTED=”YES”RECL= AND NEXTREC= are undefined

  • BACKSPACE statement: Not allowed—returns an error.

  • ENDFILE statement: Truncates file at current position, as usual.

  • REWIND statement: Repositions file to beginning of data, as usual.