When working with indexed files, how can you prevent the insertion of duplicate keys?

  • Use the ADD verb before inserting a new record
  • Specify the UNIQUE option in the FILE-CONTROL paragraph
  • Include a CHECK verb to validate key uniqueness
  • Utilize the OCCURS clause for key fields
To prevent the insertion of duplicate keys in COBOL indexed files, the UNIQUE option should be specified in the FILE-CONTROL paragraph of the program's data division. This ensures that each key value is unique within the indexed file.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *