Print debugging statement: Difference between revisions

(Add COBOL)
Line 72:
>>Ddisplay "debug line" upon syserr
 
display "from " FUNCTION MODULE-ID " in " FUNCTION MODULE-SOURCE
goback.
end program steptrace.</lang>
 
That is fixed form COBOL, columns 1 through 6 ignored by the preprocessor (historical format, from the days of punch card input) with column 7 being a special indicator column, star for comments, dash for continuations, and D is supported by GnuCOBOL for Debug lines. The <code>>>D</code> form is a newer addition to the Compiler Directing Facility, and can float anywhere on a free format compile line.
 
Along with <code>MODULE-ID</code> and <code>MODULE-SOURCE</code>, there are intrinsics for MODULE-CALLER-ID, FUNCTION MODULE-DATE, FUNCTION MODULE-FORMATTED-DATE, FUNCTION MODULE-PATH, FUNCTION MODULE-TIME.
 
{{out}}
Line 81 ⟶ 84:
explicit line
debug line
from steptrace in steptrace.cob
 
prompt$ cobc -xj -ftraceall steptrace.cob
explicit line
from steptrace in steptrace.cob
 
prompt$ export COB_SET_TRACE=Y
Line 93 ⟶ 98:
Program-Id: steptrace Statement: DISPLAY Line: 24
explicit line
Program-Id: steptrace Statement: GOBACK DISPLAY Line: 28
from steptrace in steptrace.cob
Program-Id: steptrace Statement: GOBACK Line: 30
Program-Id: steptrace Exit: steptrace</pre>
 
Anonymous user