Page 1 of 1

Debugging using COBOL display statement.

Posted: Sat Dec 19, 2015 6:22 am
by COBOL DISPLAY
We have been talking on the debugging in COBOL. We the junior programmers used debugging tools like expiditor to resolve the errors with program. But one of the senior programmer said that for a COBOL batch program DISPLAY can be a very powerful tool. And left us thinking. I am thinking what all can we do with DISPLAYs apart from just showing values from some variables? How can such a small information help in debugging readily? Does anyone else also think I'm the similar lines? If not, why not? If yes, can you share why you think so?

Appreciate any input.

Re: Debugging using COBOL display statement.

Posted: Sat Dec 19, 2015 7:10 am
by Robert Sample
DISPLAY is actually a VERY powerful tool. It allows you to show values (even COMP or COMP-3) on your output. Another simple, but effective, thing to do with DISPLAY is to put

Code: Select all

DISPLAY 'paragraph name'
immediately after each paragraph name to give you a trace facility. By selectively using them (make column 7 an asterisk for the ones you're not interested in at the time), you can zero in on a particular part of the program to look at. You can also use it to display the input buffer after reading a record so you know precisely what the input data is, or display the output buffer just before writing a record to verify things got updated correctly.

Yes, tools like Xpediter and STROBE are good debugging tools -- but since each of them can easily run more than $100,000 US dollars to buy and $20,000 US dollars per year to maintain, not every site has them available. Knowing how to use DISPLAY effectively is an important tool because there is no incremental cost (other than programmer time and a little CPU time) to use it, and DISPLAY can be used at every site (even those that have no other debugging tools available).

Re: Debugging using COBOL display statement.

Posted: Sat Dec 19, 2015 6:23 pm
by nicc
I worked with COBOL for over 2 years using only DISPLAY and brainpower (sometimes other people's) to debug. And the same is true for most of my 40 years of programming - manual. DISPLAY (PUT for Pl/1), and brainpower. Xpediter I have used - a couple of times but simpler just to know your program and use DISPLAY/PUT.

Re: Debugging using COBOL display statement.

Posted: Tue Dec 22, 2015 1:07 am
by zprogrammer
For past few years I have stopped using debugging tools, As Robert said adding Display after each Paragraph or section helps in narrowing down to the problem....

Also it helps in understanding the program flow much easier by executing it with the test input rather than starring at the piece of code

Also I worked in shop where they display the key information on WEBAPHERE calls as there would involve lot of blame game when multiple parties involved

Re: Debugging using COBOL display statement.

Posted: Tue Dec 22, 2015 3:46 am
by nicc
Tip: when displaying the contents of a variable use delimiters so that you can see the full extent of the data. Common delimiters are >< as follows:

Code: Select all

DISPLAY "variable-name >" variable-name "<"

Re: Debugging using COBOL display statement.

Posted: Mon Dec 28, 2015 2:39 pm
by COBOL DISPLAY
Robert Sample wrote:DISPLAY is actually a VERY powerful tool. It allows you to show values (even COMP or COMP-3) on your output. Another simple, but effective, thing to do with DISPLAY is to put

Code: Select all

DISPLAY 'paragraph name'
immediately after each paragraph name to give you a trace facility. By selectively using them (make column 7 an asterisk for the ones you're not interested in at the time), you can zero in on a particular part of the program to look at. You can also use it to display the input buffer after reading a record so you know precisely what the input data is, or display the output buffer just before writing a record to verify things got updated correctly.

Yes, tools like Xpediter and STROBE are good debugging tools -- but since each of them can easily run more than $100,000 US dollars to buy and $20,000 US dollars per year to maintain, not every site has them available. Knowing how to use DISPLAY effectively is an important tool because there is no incremental cost (other than programmer time and a little CPU time) to use it, and DISPLAY can be used at every site (even those that have no other debugging tools available).
nicc wrote:Tip: when displaying the contents of a variable use delimiters so that you can see the full extent of the data. Common delimiters are >< as follows:

Code: Select all

DISPLAY "variable-name >" variable-name "<"
Thanks for the answers and tip. Appreciate your help.