MainframeSupports
tip week 41/2013:

If you are working on an installation where you can use a central system for collection of execution errors I will strongly encourage you to use this system and stop reading this tip.

I have found out that very few installations (in Denmark) have a central system for collection of execution errors. The requirements for such a system are also hard to fulfill:

And I have probably forgotten other crucial requirements. The requirement list and the demands the system puts on the programmers in terms of programming style is often the reason why execution error collection remains wishful thinking. Despite this there are installations where implementation of such a system has succeded and they enjoy easy error debugging compared to other installations.

If you are tired of the lack of a central system for error logging you may use the following simple idea on how to do it for DB2 programs. First of all you need a DB2 table to log the errors in. Every time your program encounters an error that require you to rollback and you want to log it, do the following:

  1. Execute a ROLLBACK (in CICS you must use an EXEC CICS SYNCPOINT ROLLBACK instead).
  2. Perform an INSERT on your error table with as many informations as possible.
  3. Execute a COMMIT (in CICS you must use an EXEC CICS SYNCPOINT instead).
  4. Terminate execution.

Installations having a system for execution error logging typically uses MQ to log the errors because a program can write to a queue in MQ outside the scope of a rollback. But as you can see from the above example, it is not necessary to complicate error logging by using an extra component. The common perception for using DB2 for error logging is that it is not possible because data written to DB2 will be rolled back. But if you are in control of your ROLLBACK then you can just as well perform an INSERT after ROLLBACK and then issue a COMMIT. It will not affect anything apart from the fact that you have data about the execution error in a easy accessible way.

Previous tip in english        Forrige danske tip        Tip list