On Dec 27, 2007 2:16 PM, Rick Fochtman <[EMAIL PROTECTED]> wrote: > -------------------<snip>------------- > You've got that right! I see many code examples in many languages on the > Web. I tend to try to correct messages where there is "suboptimal" code. > Why? Because cut and paste programmers will continue to use that > horrible code until the end of time. Of course, I cannot fix all of it > because I really don't have the time or the talent. I would love to have > someone with a maintenance mindset do a "check" of some of our COBOL > code (no time or money for that). I rewrote a single COBOL program > myself. The run time went from about 12 hours to less than one hour. And > it was a change to only one paragraph. And not likely a truly optimal > change at that. > ---------------------<unsnip>------------------ > We did something similar. Programmer coded IDMS "PREPARE" and "FINISH" > comands inside a loop that was being executed 200,000-350,000 timer per > run! Just moving the "PREPARE" and "FINISH" commands outside the loop > cut the run time from 4+ hours to less than 20 minutes. EXCP counts > attributable to this program were cut from over 3,000,000 to less than > 400,000, dependant on actual record counts. > > If there's no alternative, you do what you must, but a sudden outbreak > of common sense should be greeted with cheers and confetti; it so seldom > happens. :-) > > A learned colleague of mine coded a process that attempted to access the same row on a DB2 table 375 million times per run. (It was a code lookup). When I pointed this out he dismissed my advice by insisting that it didn't matter because the data would be sitting in a DB2 buffer anyway so there would be no I/O cost.
What he didn't reckon on was the CPU path length of the DB2 SELECT statement he was using. It is a long way from Cobol to DB2 and back again even when DB2 doesn't do any I/O. When we changed the process to use an incore table, the CPU usage dropped from several hours to several minutes. The moral is: sometimes a *little* knowledge is more dangerous than no knowledge at all. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

