Indexed Format

The fields for the indexed format are listed here and then described below.

filename,
blocking factor,
number of blocks to pre-allocate,
number of blocks for extension,
compression factor,
Enable record encryption?;
maximum record size,
minimum record size,
number of keys;
For primary key:
    number of segments,
    Duplicates allowed?, (always zero)            
    segment size, 
    segment offset, (repeat the segment size and offset
                   pair for each segment)
For each alternate key:
    number of segments,
    Duplicates allowed?,
    segment size,  
    segment offset, (repeat the segment size and offset
                   pair for each segment);
translation table filename;
file comment

In the indexed format, the first field is the (physical) file name. The second field is the blocking factor. For Vision 5 files, the value can range from one to 16. For Vision 3 and 4 files, the value must be one or two (if a larger value is specified, it is automatically reduced to two). All I/O to the disk is done in blocks of one or two sectors. Depending on the file and the underlying disk architecture, performance can be affected by this. Although performance is difficult to predict, files that have very large keys may benefit from a larger blocking factor. See Other Vision Features for a more complete discussion.

The third field is the number of blocks to allocate to the file initially. This is usually set to one. If you want to pre-allocate some disk to the file, then this can be set to a higher number. Pre-allocation in no way limits the file, but may help performance by reducing disk fragmentation.

The fourth field is the number of blocks for extension. This determines how many blocks are allocated each time space needs to be added to the file. This helps keep fragmentation to a minimum.

The fifth field is the compression factor. A compression factor of zero (0) means no compression. A compression factor of one (1) is equivalent to the default compression (70). For factors from 2 through 100, the factor is considered to be a percentage. It specifies how much of the space saved by compression is actually removed from the record. For example, suppose an 80-byte record is compressed to 30 bytes. Then the compression factor is used to determine how much of the 50 bytes of saved space is actually removed from the record. A compression factor of 70 means that 70% of the 50 bytes (35 bytes total) is removed. This leaves 15 bytes for future expansion, and results in a compressed record size of 45 bytes (30 compressed size plus 15 extra for growth). The larger the compression factor, the more of the saved space is removed. A compression factor of 100 removes all saved space and is advisable only if the file is rarely updated.

The sixth field is a flag that determines whether record encryption is enabled. A value of one (1) enables encryption. A value of zero (0) disables encryption. A semicolon should follow the encryption flag.

The next two fields specify maximum and minimum record size. If the two numbers are identical, the records are fixed-length. If the two numbers are not identical, records are variable-length. The maximum record size allowed in Vision 5 files is 67,108,864 bytes. The maximum record size allowed in Vision 2, 3, and 4 files is 32,767 bytes.

The ninth field is the number of keys in the file, to a maximum of 120. A semicolon should follow the number of keys.

Next, you describe the primary key by at least four entries. The first entry is the number of segments in the key. The second entry is always zero (0). For each segment, you must then specify the segment size in bytes, and the segment offset from the start of the record, in bytes. If there are no alternate keys, a semicolon should follow the final segment offset. Otherwise, a comma should be used.

If there are any alternate keys, describe each one by a series of at least four entries. The first entry is the number of segments in the key. The second entry should be one (1) if duplicate values are allowed, or zero (0) if they are not. For each segment, you must then specify the segment size in bytes, and the segment offset from the start of the record, in bytes. A semicolon should follow the final segment entry of the last alternate key.

After the keys have been specified, enter the name of a file containing the translation table (collating sequence), if you want anything other than standard ASCII sorting. If the name is empty, ASCII sorting is assumed. A semicolon should follow the name of the translation file.

Finally, you may provide up to 30 bytes of comment. This comment is printed by vutil when the info option is used.

Here's a sample file entry. Suppose a file containing G/L account descriptions has a record size of 80 and two keys. The primary key is at the start of the record and is 15 bytes long. The alternate key has two segments; the first is at record offset 40 and is 30 bytes long. The second segment of the alternate key is at record offset 20 and is 5 bytes long (duplicates allowed). A compression factor of 30 and ASCII sorting are desired. The corresponding entry is:

glactfil,1,1,0,30,0;80,80,2;1,0,15,0,2,1,30,40,5,20; ;G/L account
			 master