It's not an exact equivalent, but you can use READY TRACE for debugging. Enable it with the TRACE compiler directive.
Can the system trace function be set in MicroFocus Cobol?
-
31-05-2022 - |
Domanda
Does MicroFocus Cobol or any other, have a feature equivalent to Python's sys.settrace()? The function passed as a parameter to such a tracing function, would be called after the execution of each line of the source code.
Soluzione
Altri suggerimenti
OpenCOBOL supports
-ftrace Generate trace code
- Executed SECTION/PARAGRAPH
-ftraceall Generate trace code
- Executed SECTION/PARAGRAPH/STATEMENTS
- Turned on by -debug
cobc command line options. This isn't quite the same as the Python point of view, but outputs a tracer round on entry to sections, paragraphs and sentences when enabled. No doubt other compilers will have something equivalent. Along with the READY TRACE, debugging and >>D other debugging features like those allowed with DECLARATIVES. http://opencobol.add1tocobol.com/#declaratives
procedure division.
declaratives.
handle-errors section.
use after standard error procedure on filename-1.
handle-error.
display "Something bad happened with " filename-1 end-display.
.
helpful-debug section.
use for debugging on main-file.
help-me.
display "Just touched " main-file end-display.
.
end declaratives.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow