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.

有帮助吗?

解决方案

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

其他提示

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.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top