Which mode of opening is required when REWRITE is used?
-
INPUT
-
OUTPUT
-
I-O
-
EXTEND
-
All of the above
-
None of the above
C
Correct answer
Explanation
The REWRITE verb in COBOL requires the file to be opened in I-O (Input-Output) mode. This is because REWRITE reads an existing record and then writes it back in the same position - it needs both read and write access. INPUT mode only allows reading, OUTPUT mode only allows writing new records, and EXTEND mode only adds records at the end.