Created On:  22 June 2011

Problem:

The COBOL application loops continously until an operator terminates the application.  It first connects to a database and reads transactions from a table, then goes into an idle mode wherein the application is just incrementing a counter until it reaches a specific value.   It then connects to an external database and updates an external table, goes back into idle mode, and the whole cycle begins again. During this idle period the CPU usage is very high as measured by Task Manager. The application is just counting and there is no I/O yet the CPU usage spikes during this time. Is there a parameter somewhere that we can change to lower the CPU usage without changing the code?

Resolution:

If the application is incrementing a counter then it is still utilizing the CPU.  You should instead call the library routine CBL_THREAD_SLEEP or the winapi Sleep function to actually relinquish the time slice back to the OS.  This should lower the CPU usage dramatically.
Incident #2524285