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.
COBOL DISPLAY

Debugging using COBOL display statement.

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Debugging using COBOL display statement.

Post 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).
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Debugging using COBOL display statement.

Post 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.
Regards
Nic
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: Debugging using COBOL display statement.

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

Re: Debugging using COBOL display statement.

Post 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 "<"
Regards
Nic
COBOL DISPLAY

Re: Debugging using COBOL display statement.

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “You are a Guest.”