I am trying to retrieve the execption error message of a SQL statement used in the SQLRPGLE program, and write into a LOG file with this error message. For this I am using System Data strucure as follows:
D SDS
D sdProgram *proc
D sdMessageId 40 46A
D sdMessageText 91 170A
C*
C/EXEC SQL
C+ SELECT ABALPH INTO :ALPH
C+ FROM FILE01 WHERE
C+ ABAT1 = 'B'
C/END-EXEC
C SQLCOD IFNE 0
C EVAL ERRMSG = sdMessageText
C ENDIF
C*
and checking the SQLCOD <> 0. I expected that the error message will be stored in the variable "sdMessageText" when SQLCOD <> 0. But this variable contains blanks even if the SQL statement fails.
Is there any other way to fetch the SQL error message using SQLRPGLE program?
Thanks in advance.
D SDS
D sdProgram *proc
D sdMessageId 40 46A
D sdMessageText 91 170A
C*
C/EXEC SQL
C+ SELECT ABALPH INTO :ALPH
C+ FROM FILE01 WHERE
C+ ABAT1 = 'B'
C/END-EXEC
C SQLCOD IFNE 0
C EVAL ERRMSG = sdMessageText
C ENDIF
C*
and checking the SQLCOD <> 0. I expected that the error message will be stored in the variable "sdMessageText" when SQLCOD <> 0. But this variable contains blanks even if the SQL statement fails.
Is there any other way to fetch the SQL error message using SQLRPGLE program?
Thanks in advance.
Comment