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.
Loading...
Related Quiz
- In file handling, what does the term "buffering" refer to?
- You are developing a COBOL program that needs to calculate the square root of a given number. Which COBOL intrinsic function would you use for this purpose?
- What is the role of the INITIALIZE statement in COBOL?
- When performing date arithmetic in COBOL, you often use the _____ verb.
- The _____ file organization in COBOL is used for storing records in the order they are written.