I'm running Apache on the IBM i, set up for CGI calls to RPG ILE programs that use embedded SQL.
I'm getting various SQL errors in these programs (eg "Indicator variable required" and "Cursor not open"), but I can't find which programs specifically are causing these issues. There are many hundreds of programs in this system, and hitting F1 on the error messages does not specify the source program (the message is from/to 'QSQRUN2').
I can't recompile every program in debug mode, which might give more information (production system, some source issues).
Any ideas on how to get this information?
@user2338816 gave this answer in the comments.
There is an easy way to add SQL monitoring for specific jobs.
STRDBMON OUTFILE(QGPL/DBMON) JOB(*ALL/QTMHHTTP/WEBSERVER) FTRSQLCODE(*NONZERO)
Starts a monitor that monitors all jobs (current or future) for user QTMHHTTP, job WEBSERVER, logging all statements that give a warning or error.
See here for details on the resulting QGPL/DBMON database file.
You can then cross reference the job number/time in the job log if you need some context.