The code fragment below shows how to log permanent file errors into the runtime's error file. Normally, you would also use the +e runtime flag to name the error file and cause new messages to be appended to the end of the file.
ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. SYSERR IS ERROR-LOG. PROCEDURE DIVISION. DECLARATIVES. CUSTOMER-ERROR-PROCEDURE. USE AFTER STANDARD ERROR PROCEDURE ON CUSTOMER-FILE. CUSTOMER-ERROR. IF CUSTOMER-FILE-STATUS = "30" OR "98" CALL "C$RERR" USING EXTENDED-STATUS DISPLAY "CUSTOMER FILE ERROR", EXTENDED-STATUS UPON ERROR-LOG.