IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Benefits of removing DISPLAY statements


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Thu Aug 13, 2015 12:38 pm
Reply with quote

Hi All,

I completely agree that DISPLAY statements are very helpful in debugging in case of failures. But keeping DISPLAY statements for every record we read from VSAM Master files is not a good practice.

One of my program has a DISPLAY statement in it which gets processed for 250,000 times and prints values on SYSOUT each time. Program used by a Daily job.

I don't see much difference in CPU usage in running the program with and without DISPLAY statements.

What are the other benefits I will get in terms of cost savings ?
As programs DISPLAYS unnecessary information on SYSOUT that spreads for 250,000 lines, When I remove the DISPLAYS I will save some space. how to calculate it ?

Numbering internationalised
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Thu Aug 13, 2015 1:02 pm
Reply with quote

The benefit is in saving spool space.

To see what the space saving would be, maybe try directing SYSOUT to a dataset and see how much space that uses - you'll have to allow for any non-DISPLAY data written to SYSOUT.

Garry
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Thu Aug 13, 2015 2:07 pm
Reply with quote

@Garry Carroll,
thank you. I will write the spool to a file and estimate the space .

Let's see if there are any other benefits with it.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 13, 2015 2:25 pm
Reply with quote

I'm not a big advocate of "whack in some DISPLAYs and see". I'm not even a very small advocate of that.

However, don't even consider taking them out without testing.

One reason I don't like the DISPLAY for "debugging" is that it changes the code, and on occasion that "hides" a problem.

Another reason is that the DISPLAY, for numeric fields, is not always showing you what is actually in the field, such that you may miss a problem simply because the DISPLAY is "lying" to you.

The way to deal with numerics is to MOVE them to numeric-edited items and then DISPLAY that. Do people do that? Not very much.

Another reason is that if you have 250,000 "useless" DISPLAYs, it is "difficult" to spot one meaningful DISPLAY, because it is one amongst 250,000.

Another reason is making the program smaller, and removing non-business requirement "noise".

Another reason is 250,000 is one thing, if you have a Big Fat Loop at some point, you risk filling the spool and making yourself somewhat unpopular.

Etc.

Take them out, but test it.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 13, 2015 3:18 pm
Reply with quote

What is 2,50,000 lines? 250.000? or 2.500.000?

And why is there not a JES2 limit for sysout?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Aug 13, 2015 4:58 pm
Reply with quote

PeterHolland wrote:
What is 2,50,000 lines? 250.000? or 2.500.000?
That's a bit confusing, but this is the way the Indian numbering system works.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 13, 2015 6:20 pm
Reply with quote

Quote:
I don't see much difference in CPU usage in running the program with and without DISPLAY statements.
You won't. The current generation of mainframes can execute many, many, many millions of lines of COBOL for each second of CPU time. So removing 250,000 DISPLAY statements won't have much of a CPU impact.

The cost savings, if that is how you are attempting to justify doing this, probably won't be enough to justify doing it. SYSOUT goes to the JES spool (JES2 or JES3), which is pre-allocated and sized by your system support group to handle the entire site. Removing 250,000 DISPLAY statements may allow some other job to use that spool space -- but if your site is that tight on spool space, you'd be running into major issues getting work completed.

The best justification for this is to remove the annoyance factor of not having to see 250,000 lines of output every day. That would be worth quite a bit to me. And if you do get rid of the DISPLAY statement, don't delete them from the code -- change them to comments or debug statements instead by putting an * or a D in column 7!
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Thu Aug 13, 2015 6:43 pm
Reply with quote

As Robert alluded to, I like to use the "with debugging mode" option of SOURCE-COMPUTER to turn displays on and off. It does require a recompile though.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Aug 13, 2015 7:27 pm
Reply with quote

PeterHolland wrote:
What is 2,50,000 lines? 250.000? or 2.500.000?

And why is there not a JES2 limit for sysout?
Some production shops rig production jobs to have unlimited - or at least very large - SYSOUT limits. I'm inclined to agree with Mr. Sample: the hassle factor of getting rid of the debug output is worth the effort to recertify the program.

It's not necessarily just a JES2 issue, too. Sometimes this output is intercepted by SYSOUT archivers, so it's less space required there. It seems kind of dumb to hang onto debug output for 7 years - or whatever the shop standard is!
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 13, 2015 8:43 pm
Reply with quote

Well Marso,
Quote:
That's a bit confusing, but this is the way the Indian numbering system works.
I don't really care about Indian numberings. International numbering is what is important. Maybe they are using sanskrit keyboards etc., then i have a hebrew keyboard.
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 203
Location: Toronto, ON, Canada

PostPosted: Thu Aug 13, 2015 11:54 pm
Reply with quote

Consider using
Code:
DISPLAY something UPON SYSPUNCH
to display a status message to a separate dd SYSPUNCH. It has the added bonus of putting the program name in column 73. This can be sent to sysout which allows you to see the status of a program while it is running.
Another option is to use a counter and display only for every 1000th record
Code:
ADD 1 TO WS-DISPLAY-COUNT
IF WS-DISPLAY-COUNT = 1000 THEN
  DISPLAY something
  MOVE 0 TO WS-DISPLAY-COUNT
END-IF
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 14, 2015 1:14 am
Reply with quote

That's a nice tip, Jerryte, thanks. I didn't know that.

Anyway, for the topic, junk the DISPLAYs, don't leave them lying around to confuse the code (comments or D in the indicator column, column seven). Remember, they were what someone thought would be useful for some purpose at some time. They may not be, they may be wrong, they may be misleading. They may/will lead you astray one time.

If you feel the overwhelming urge to put DISPLAYs in, think about what you really need, format numeric items, or display the stuff in hex (use the search link about to look for BBHEXD).
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Aug 14, 2015 2:14 pm
Reply with quote

The place I worked had a special sysout class (SYSOUT=0) that automatically was purged.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Fri Aug 14, 2015 4:13 pm
Reply with quote

Places I have worked do not allow debugging DISPLAYS to be active in production code. A change would get bounced if they were found.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Fri Aug 14, 2015 5:12 pm
Reply with quote

Hi All,
Lots of valuable points shared here. Thank you.

Moderators,
Thanks for correcting the Indian number system to International icon_biggrin.gif

@Bill Woodger,
All the 250,000 DISPLAY statements are useless and does not serve any purpose. There is another DISPLAY statement in place for Error Handling.

@PeterHolland, @Marso, It's Indian Number system.

@Robert Sample, Yes, I will only comment out the unwanted DISPLAYs.

@PeterHolland, SYSOUT =0 I will try it out. But this will purge even the useful messages as well.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Fri Aug 14, 2015 6:01 pm
Reply with quote

mkk157 wrote:
@PeterHolland, SYSOUT =0 I will try it out. But this will purge even the useful messages as well.

Note that this is specific to Mr. Holland's machine. As sysout classes are wholly arbitrary, you must ask your support workgroup what, if anything, is the equivalent in your shop.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sat Aug 15, 2015 1:23 pm
Reply with quote

If you don't mind doing the I/O and not seeing the result, you can also:

Add a CBL statement right before the ID DIVISION:
Code:
 CBL OUTDD(SYS099)


Use the UPON parameter:
Code:
    DISPLAY UPON SYSLIST


Then have a DD for this logical unit, assigned to SYSOUT or DUMMY, according to your need.
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 203
Location: Toronto, ON, Canada

PostPosted: Mon Aug 17, 2015 7:56 pm
Reply with quote

The OUTDD(ddname) compiler option will change where a regular DISPLAY statement is written to instead of the default SYSOUT dd.

Version 4 of Enterprise COBOL seems to allow a
Code:
DISPLAY something UPON SYSLIST
I have not tried it yet.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Dynamically build sort control statem... SYNCSORT 18
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts How to display the leading zeros of a... DB2 7
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts Removing date values lines/records fr... SYNCSORT 2
Search our Forums:

Back to Top