ILE C/C++ Programmer's Guide

Duplicate Key Values

When a record has key fields whose contents are the same as another record's key fields in the same file, the file has records with duplicate key values. For example, if the record has two key fields num and date, duplicate key values occur when the contents of both num and date are the same in two or more records.

If you want an indication that your program is processing a record that contains a duplicate key value, specify dupkey=y on the call to _Ropen() that opens the file. If an I/O operation on a record is successful and a duplicate key value is found in that record, the dup_key flag in the _RIOFB_T structure is set. (The _Rreadd() function does not update this flag.)

Note:
Using the dupkey=y option on the call to the _Ropen() function may cause your I/O operations to be slower.

You can avoid duplicate key values by specifying the keyword UNIQUE in the DDS file.


[ Top of Page | Previous Page | Next Page | Table of Contents ]