[next] [previous] [contents]

  14.8.1 BUCKETSIZE Clause
  The BUCKETSIZE clause applies only to relative and indexed
  files. A bucket is a logical storage structure that RMS uses
  to build and maintain relative and indexed files on disk de-
  vices. A bucket consists of 1 or more disk blocks. The default
  bucket size is the record size rounded up to a block boundary.
  Although RMS defines the bucket size in terms of disk blocks,
  the BUCKETSIZE clause specifies the number of records a
  bucket contains. For example:
  OPEN "STOCK_DATA.DAT" FOR OUTPUT AS FILE #1%, &
            ORGANIZATION RELATIVE FIXED, BUCKETSIZE 12%

  This example specifies a bucket containing approximately 12
  records. RMS reads in entire buckets into the I/O buffer at
  once, and a GET statement transfers one record from the I/O
  buffer to your program's record buffer.

  When you open an existing relative or indexed file and spec-
  ify a bucket size other than that originally assigned to the
  file, BASIC signals the error, ``File attributes not matched''
  (ERR=160).

  Records cannot span bucket boundaries. Therefore, when
  you specify a bucket size in your program, you must consider
  the size of the largest record in the file. Note that a bucket
  must contain at least one record. Buckets in both relative and
  indexed files contain information in addition to the records
  stored in the bucket. You should take this into consideration.

  There are two ways to establish the number of blocks in a
  bucket. The first is to use the default. The second is to specify
  the approximate number of records you want in each bucket.
  A bucket size based on that number is then calculated.

  The default bucket size assigned to relative and indexed files
  is as small as possible. A small bucket size, however, is rarely
  desirable.

  A default bucket size is selected depending on:

  .
        The record length
  .
        The file organization (relative or indexed)
  .
        The record format

  If you do not define the BUCKETSIZE clause in the OPEN
  statement, BASIC does the following:

  .
        Assumes that there is a minimum of one record in the
        bucket
  .
        Calculates a size
  .
        Assigns the appropriate number of blocks

  Note that when you specify a bucket size for files in your
  program, you must keep in mind the space versus speed
  tradeoffs. A large bucket size increases file processing speed
  because a greater amount of data is available in memory
  at one time. However, it also increases the memory space
  needed for buffer allocation and the processing time required
  to search the bucket. Conversely, a small bucket size min-
  imizes buffer requirements, but increases the number of
  accesses to the storage device, thereby decreasing the speed of
  operations.

  Digital recommends that you use the DCL command EDIT
  /FDL to design files used in production applications where
  performance is a concern.