Even a syntactically correct COBOL program may still have logic errors and therefore not run as intended. A number of different aids are available to the COBOL programmer for detecting and correcting such errors:
The programmer can use the Advanced Interactive Debugger (AID) during program execution. This requires no special programming provisions and permits errors to be detected and corrective action to be taken while the loaded program is being executed.
Debugging lines can be inserted in the compilation unit and activated by the programmer as the need arises. This assumes that potential error conditions were anticipated and provided for when the compilation unit was written. The diagnosis of an unexpected error can therefore make it necessary to modify or add debugging lines and then recompile the entire compilation unit. Debugging lines are described in “COBOL2000 Reference Manual” [1] and in section "Debugging lines".
The debugging aids can be used analogously in the POSIX subsystem (see the chapter "COBOL2000 and POSIX").