[next] [previous] [contents]

  19.1.5 Writing Records to a File
  The PUT statement writes sequential records to the file. The
  following program writes a record to the file. Successive PUT
  operations write successive records.
  OPEN "MT0:TEST.DAT" FOR OUTPUT AS FILE #2, &
                        SEQUENTIAL FIXED, RECORDSIZE 20%
  B$ = ""
  WHILE B$ <> "NO"
          LINPUT "Name"; A$
          MOVE TO #2, A$ = 20
          PUT #2
          LINPUT "Write another record"; B$
  NEXT
  CLOSE #2
  END

  Each PUT writes one record to the file. If your OPEN state-
  ment specifies a RECORDSIZE clause, the record buffer
  length equals RECORDSIZE or the map size. For example:
  RECORDSIZE 60%

  This clause specifies a record length and a record buffer size
  of 60 bytes. You can specify a record length from 18 to 8192
  bytes. The default is 132 bytes.

  If you specify a MAP clause and no RECORDSIZE clause,
  then the record size is the size of the map.

  If you also specify BLOCKSIZE, the size of the buffer equals
  the value in BLOCKSIZE multiplied by the record size. For
  example:
  RECORDSIZE 60%, BLOCKSIZE 4%

  These clauses specify a logical record length of 60 bytes and
  a physical tape record size of 240 bytes (60
                                                                *

                                                                    4). You specify
  BLOCKSIZE as an integer number of records. RMS rounds
  the resulting value to the next multiple of four. The total
  I/O buffer length cannot exceed 8192 bytes. The default is a
  buffer (tape block) containing one record.

  To write true variable-length records, use the COUNT
  clause with the PUT statement to specify the number of bytes
  of data written to the file. Without COUNT, all records equal
  the length specified by the RECORDSIZE clause when you
  opened the file.