[next] [previous] [contents]

  19.1.2 Opening a Tape File for Output
  To create and open a magnetic tape file for output, use the
  OPEN statement. The following statement opens the file
  PARTS.DAT and writes 256-byte records that are blocked
  four to a physical tape block of 1024 bytes:
  OPEN "MT1:PARTS.DAT" FOR OUTPUT AS FILE #2%, SEQUENTIAL FIXED, &
                        RECORDSIZE 256%, BLOCKSIZE 4%

  Specifying FIXED record format creates ANSI F format
  records. Specifying VARIABLE creates ANSI D format
  records. If you do not specify a record format, the default is
  VARIABLE.



                                            Note

        Every record in an ANSI D formatted file is pre-
        fixed by a 4-byte header giving the record length
        in decimal ASCII digits. The length includes the 4-
        byte header. BASIC adds the 4-byte header to the
        record size when calculating block size. The header is
        transparent to your program.

  If you do not specify a block size, BASIC defaults to one record
  per block. For small records, this can be inefficient; the tape
  will contain many interrecord gaps.