This routine opens the transaction log file defined in the LOG_FILE configuration variable and replays all of the file operations recorded in it on the appropriate data files.
Note that file systems other than Vision may require you to use their own recovery routines, instead of C$RECOVER. Please refer to your file system manufacturer's documentation to learn how the file system handles recovery procedures.
This routine allows you to recover from a hardware failure or power outage that may have left your data files in a corrupt state. C$RECOVER is helpful for recovering from error 98s and from any error that leaves your data damaged or possibly destroyed.
In order to use this routine, you need to have been logging transactions with the START TRANSACTION and COMMIT TRANSACTION verbs. These cause file operations to be logged in log files that you designate with the LOG-FILE. Use the LOG_INCLUDE_PATTERN or LOG_EXCLUDE_PATTERN variables to determine which files' operations are recorded in the log file.
You also need a good backup of your data files. This backup should have been created just before you cleared or deleted the log file. You use your backup to restore the damaged files. Then you use C$RECOVER to read the log and recreate all of the file operations in the log, in the same sequence they were logged. These file operations are replayed on the data files. Use the LOG_RECOVER_REPORT variable to write an audit trail of the recovery process to a file.
The result is that your data files are brought up to date. After recovery, all files will be in a consistent state, because only committed (completed) transactions will be replayed from the log.
One way to use this routine is described here. First get everyone off the system. Then restore your clean backup files to their original locations. (It's a good idea to have more than one backup, because you will need a clean backup in order to recover.) Then run a COBOL program that calls the C$RECOVER routine (for example, CALL C$RECOVER). Make sure that the LOG-FILE configuration variable is set correctly. Repeat this procedure for each log file.
If a GIVING phrase is omitted, the special register RETURN-CODE is updated: a zero indicates a successful recovery, and any other value indicates a failure. The failure value corresponds to a transaction error code; see Transaction Error Codes in Appendix E of the ACUCOBOL-GT Reference Manual for a full list of values.
To make sure that your data can be recovered, follow these guidelines: