Error Codes Returned by the Compiler

The error messages issued by the Compiler are classed according to their severity as follows:

Severity Return Value Description
Unrecoverable 16 Indicates a fatal error
Severe 12 Indicates an error that the Compiler was unable to correct. Compilation continues, but the statement at fault is not compiled
Error 8 Indicates an error which the Compiler has attempted to correct
Warning 4 Flags a statement that although is syntactically correct may contain a possible error
Informational See INFORETURN Draws your attention to something in your source code of which you should be aware

The Compiler returns a value to the operating system to show the most severe type of message it issued.

If you invoked the Compiler from within a batch file, you can test this value using the Windows IF ERRORLEVEL n command. This executes a specified command if the return value is n or higher. For example, if your batch file contains:

cobol myprog;
if errorlevel 8 goto abortjob

then control jumps to ABORTJOB if the Compiler issues any message of severity Unrecoverable, Severe, or Error.