Search code examples
cobolmicrofocus

Cobol open input file error message


What is the error handling command for open input line-sequential file?

I tried,

OPEN INPUT CUSTOMER-FILE
INVALID KEY/ON ERROR
DISPLAY "NO FILE FOUND".

but could not get it to work.

Thanks.


Solution

  • In FILE-CONTROL, add a FILE STATUS clause to the SELECT for your file and in the PROCEDURE DIVISION check the value of the file status variable you specified against the documented values after each file interaction.