Considerations When Writing Indexed Files

Before the WRITE statement is executed, you must set the prime record key (the RECORD KEY data item, as defined in the File-Control entry) to the desired value. When the WRITE statement is processed, the system releases the record.

IBM Extension

IBM Extension If the DUPLICATES phrase is specified, record key values for a format need not be unique (see RECORD KEY Clause). In this case, the system stores the records so that later sequential access to the records allows retrieval in the order specified in DDS. End of IBM Extension

End of IBM Extension

If records are written to an indexed file of fixed size when it has SEQUENTIAL access, is open for OUTPUT, and blocking is in effect (BLOCK CONTAINS clause is specified), the blocking factor will change to 1 at the point at which a block of records would cause the end-of-file to be reached.

If the ALTERNATE RECORD KEY clause is also specified in the File-Control entry, each alternate record key must be unique, unless the DUPLICATES phrase is specified. If the DUPLICATES phrase is specified, alternate record key values need not be unique.

The number of remaining records in the file at this moment is less than the number of records in a block.

When ACCESS IS SEQUENTIAL is specified in the File-Control entry, records must be released in ascending order of RECORD KEY values.

When ACCESS is RANDOM or ACCESS IS DYNAMIC is specified in the File-Control entry, records may be released in any programmer-specified order. If the FORMAT phrase is not specified on the I-O statement when indexed files are accessed in random access mode, the first format defined is used. When writing to a multiformat logical file, the format must be specified on the WRITE statement.