Welcome to myCobol.net Wednesday, 21 August 2019, 02:55 @ CEST

Debugging your Cobol Text

  • Contributed by:
  • Views: 1,202
CoCoS It is often heard, generally speaking, from programmers that finding a bug takes time and that is hard to asses too. Could be 5 minutes (if you just would let me...), 2 hours or maybe even a couple of days. No prediction.

According to CoCoS that can't be true. Hunting bugs is time consuming, indeed, but, besides writing your Text in anticipation of a debug session at some point of time, the time necessary to find the misbehavior (often due to a typo) can be reduced and even easily assessed. CoCoS advises to structure your workings in such manner that debugging can cost 5 minutes upto two hours OR a full day. No more.

Test the program in the normal way. For about 5 - 10 minutes. Than formulate a test case to get some input when analyzing the behavior.
If you're still unlucky, refactor your text so, that in all important places a DISPLAY is inserted. Which means in any paragraph, within any IF, and about any condition that could arise. Refactor in such a way that these debugging help can easily be discarded when the bug is found. Mind the periods. Test the program.

Learn from the bug. Did the cause lie in your Text writing habits, a cut and paste that went wrong, or maybe in the constructs you use? Would this bug be avoided if you changed your approach ?
Compare the time you needed with the time to produce the Text. Keep a Log.

A well known gotcha is the period and a worn out printer. A period is printed by just one matrix dot. Low on ink, a worn out matrix or a bad ribbon does not print that dot. A hanging period (which is btw a bad standard) resembles in such circumstances a space line.

CoCoS advises to never have blank lines in your Text. Use the asterisk as comment indicator to indent vertically. Always.