Navigation: Language Reference > 5 - Declaration Attributes > Variable and Entity Attributes >====== DUP (allow duplicate KEY entries) ====== | |
DUP
The DUP attribute (PROP:DUP) of a KEY declaration allows multiple records with the same key values to occur in a FILE. If the DUP attribute is omitted, attempting to ADD or PUT records with duplicate key values will generate the “Creates Duplicate Key” error, and the record will not be written to the file. During sequential processing using the KEY, records with duplicate key values are accessed in the physical order their entries appear in the KEY. The GET and SET statements generally access the first record in a set of duplicates.
The DUP attribute is unnecessary on INDEX declarations because an INDEX always allows duplicate entries.
Example:
Names FILE,DRIVER('Clarion'),PRE(Nam)
NameKey KEY(Nam:Name),DUP !Declare name key, allow duplicate names
NbrKey KEY(Nam:Number) !Declare number key, no duplicates allowed
Rec RECORD
Name STRING(20)
Number SHORT
END
END
See Also: