Wednesday, October 30, 2019

Rexx to track your error SQLCODE

30 october 2019

It is always interesting to have a tool to track errors in sql, because :

  • An application error can happen and nothing is seen in MSTR, DBM1 ..
  • Optimize your code as unnecessary and repeated errors is waste of CPU  
It happens to us recently, a DBA launched a creation of triggers in Production as requested by the development, unfortunately the triggers don't work correctly driving the triggering SQL statements (inserts, updates) to have negative sqlcode. As the negative sqlcode is not well signaled in the program, the application support doesn't know what happens to the programs and  15 long minutes  happen between the alert and the problem resolution, and it was by chance because the DBA is here to check his triggers and realized that there is a problem.
We had Apptune , but it was disabled to save some CPU consumption. 
So i decided to write this Rexx to do exactly what Apptune does : Start a trace and then IFI Read from Opx buffers.

Update 27/05/2020 : 

Follow this link to get the Rexx code to read IFCID 0053 
https://github.com/ndt98/Db2z/blob/master/ifc053.rex