Pregunta

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.

¿Fue útil?

Solución

It's not an exact equivalent, but you can use READY TRACE for debugging. Enable it with the TRACE compiler directive.

Otros consejos

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.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top