Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Characteristics of indexed file organization

Each record in an indexed file is assigned a key, i.e. a sequence of arbitrary (including non-printable) characters that uniquely identify the record in the file. The starting position (KEYPOS) and the length (KEYLEN) of the keys are identical for all records of a file.

The position and length of the key in the record are specified by means of a key data item defined in the program. An index is maintained for this item, enabling any record in the file to be accessed directly (randomly) via its record key. In addition to the options available for sequentially organized files, this facility allows the following operations in an indexed file:

  • records can be created randomly,

  • records can be read and updated randomly,

  • records may be inserted at a later stage, and

  • existing records can be logically deleted.

COBOL programs use the indexed sequential access method (ISAM) of DMS (see “Introductory Guide to DMS” [4]) for processed indexed files. This method allows several users to update a file simultaneously (see section "Shared updating of files (SHARED-UPDATE)" ).

Indexed files can be created on disk storage only.

File structure

A detailed description of the structure of ISAM files is provided in “Introductory Guide to DMS” [4]; the following description merely provides a quick review of the most important facts:

An ISAM file consists of two components, each of which serve different functions:

  • index blocks and

  • data blocks.

If private volumes are used, index and data blocks may reside on different volumes.

  • Data blocks contain the user’s records. These records are logically linked together in ascending order of their keys; their physical sequence on the volume is arbitrary.

    Data blocks can have a length of one PAM block (2048 bytes) or an integer multiple thereof (up to 16 PAM blocks).

  • Index blocks serve to locate data records via the record key. They can be classified into various index levels:

    Index blocks of the lowest level contain pointers to data blocks, while index blocks of higher levels have pointers to the index blocks of the next lower level.

    The highest-level index block is always created in the file, even if the file does not hold any records. In addition to the pointers, this block contains a 36-byte area for ISAM label information.

    Entries in index blocks are always arranged physically in the order of ascending record keys; they must therefore be reorganized whenever new index or data blocks are generated in the level below.

    Index blocks have a fixed length of one PAM block.

Block splitting

When an ISAM file is extended, each new record is inserted into the data block to which it belongs, based on the value of its record key.
At times, the space available in this block may prove insufficient for the inclusion of a further record. In such cases, the old block is split, and the resulting halves are entered into new (empty) blocks. The old block remains allocated to the file, but is now marked as free (see the “Introductory Guide to DMS” [4]).

Frequent splitting of blocks slows down processing. However, this can be largely avoided by reserving space in the data blocks for later extensions when the file is first created. This is achieved by using the PADDING-FACTOR operand in the ADD-FILE-LINK command when the output file is assigned. The PADDING-FACTOR operand serves to specify the percentage of a data block that is to remain free for subsequent extensions when loading the file.

Example 9-10

Use of the PADDING-FACTOR operand when assigning an ISAM file

When the file ISAM.OUTPUT is created, only about one in four records is to be initially available, with 75% of each data block being reserved for future extensions. This is accomplished by means of the following ADD-FILE-LINK command:

/ADD-FILE-LINK OUTFILE,ISAM.OUTPUT,ACCESS-METHOD=ISAM,PADDING-FACTOR=75