Debugging using COBOL display statement.

This Forum is for the guests or the users who are not registered on this board. This part allows guests to post in.
Previous topicNext topic

Topic Author
COBOL DISPLAY

Debugging using COBOL display statement.

Post by COBOL DISPLAY » Sat Dec 19, 2015 6:22 am

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.



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1379
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Debugging using COBOL display statement.

Post by Robert Sample » Sat Dec 19, 2015 7:10 am

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
Global Moderator
Global Moderator
Posts: 597
Joined: Wed Apr 23, 2014 8:45 pm

Re: Debugging using COBOL display statement.

Post by nicc » Sat Dec 19, 2015 6:23 pm

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.


Regards
Nic


zprogrammer
Global Moderator
Global Moderator
Posts: 605
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars
Zodiac: Libra

Re: Debugging using COBOL display statement.

Post by zprogrammer » Tue Dec 22, 2015 1:07 am

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


zprogrammer


nicc
Global Moderator
Global Moderator
Posts: 597
Joined: Wed Apr 23, 2014 8:45 pm

Re: Debugging using COBOL display statement.

Post by nicc » Tue Dec 22, 2015 3:46 am

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 "<"


Regards
Nic


Topic Author
COBOL DISPLAY

Re: Debugging using COBOL display statement.

Post by COBOL DISPLAY » Mon Dec 28, 2015 2:39 pm

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.



Previous topicNext topic

Return to “You are a Guest.”