Almost two years ago in week 12/2010 I wrote a tip about how to measure the CPU usage in a CICS program. Unfortunately this piece of code does not work any more if your CICS installation has been upgraded to CICS Transaction Server 3.2 or newer. In older versions of CICS my previous tip still works. Now I will show you a piece of code that works regardless of CICS version (except very old ones where COLLECT was not invented):
In comparison to the previous tip I have introduced an EXEC CICS SUSPEND as this command forces CICS to update CPU time. Using the earlier tip I sometime experienced a CPU time of zero being returned although I knew the the task had used a lot of CPU. SUSPEND fixed that. In CICS TS 3.2 the length of the DFHMNTDS-NEW area is about 2360 bytes long (may vary a bit on your installation) and I am pretty sure the corresponding area in CICS TS before 3.2 is less than 2300 bytes long. I use this length to test whether I should use the old or the new definition of DFHMNTS.
As an extra feature in CICS TS 3.2 the CPUTIME has been given the same precision as the CPU time in the ASCB. It is probably because of the less precise CPU time in earlier versions that it now has been changed. Unfortunately this change hurt my previous tip on the subject. On the other hand I can now confirm that CPUTIME includes all CPU time consumed by the task no matter how the transaction is configured.