ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Tracing SQL errors from job log? (error points to QSQRUN2)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tracing SQL errors from job log? (error points to QSQRUN2)

    If, for example, you have an RPGLE program doing an SQL Select into host variables, but the SQL select returns multiple rows, the SQL statement will fail with state 21000, code -811 error "Result of SELECT more than one row".

    Now say I have a massive set of programs doing lots of selects, where the original programmer opted to ignore SQL errors on many of them and proceed without erroring out or logging the error. The process completes, but I see lots of instances of this error in the job log.

    But because its embedded SQL, rather than providing the statement number of the failed select statement in the RPGLE, the error provides the statement number in program QSQRUN2 or similar.

    Is there any way to trace these SQL errors to an RPGLE statement number, short of debugging and checking each select statement individually?

  • #2
    I am searching the direction for this same issue. Did you find any solution for this?

    Comment


    • #3
      Did you had a look at the SQL Error Logging Facility (SELF)?
      https://www.ibm.com/docs/en/i/7.5?topic=tools-sql-error-logging-facility-self

      Comment


      • #4
        Originally posted by B.Hauser View Post
        Did you had a look at the SQL Error Logging Facility (SELF)?
        https://www.ibm.com/docs/en/i/7.5?topic=tools-sql-error-logging-facility-self
        Thanks !
        Last edited by MFisher; May 30, 2023, 09:01 AM.

        Comment

        Working...
        X