In HP COBOL compatibility mode, duplicate primary key values are allowed if the indexed file system supports them and the WITH DUPLICATES phrase is specified in the File-Control paragraph. Vision supports duplicate primary key values. The syntax is:
RECORD KEY IS key-name [= seg-name] [WITH [NO] DUPLICATES]
The phrase WITH NO DUPLICATES is commentary because, by default, duplicate values are not allowed for the primary key.
The phrase WITH DUPLICATES indicates that duplicate primary key values are allowed. If WITH DUPLICATES is used with a file system that doesn't support duplicate primary keys, when the file is created via the OPEN statement a status of 0M is returned, indicating that the file was successfully created but that duplicate primary keys are not supported.
When WITH DUPLICATES is used with Vision and other file systems that support it, the rules that govern how REWRITE and DELETE operations are handled are determined by the file system. This is because support for duplicate primary keys is not part of the ANSI 1985 Standard, few files systems support it, and therefore no common rules exist. The rules for Vision are given in General Rule 14 of File-Control Paragraph.