Retrieving messages without truncation

You can retrieve long message text from the CONTAINS or SCORE functions and from the text search administration stored procedures.

About this task

Message text that is longer than 70 bytes is truncated in SQLCA and in the DSNTIAR output.

Procedure

To print the full text of a message:

Issue the GET DIAGNOSTICS statement.

Example

void sql_longmessage()
{
    EXEC SQL BEGIN DECLARE SECTION;
    char messageId[10] = {0};
    char messageText[2048] = {0};
    EXEC SQL END DECLARE SECTION;
    EXEC SQL GET DIAGNOSTICS CONDITION 1
        :messageId = DB2_MESSAGE_ID,
        :messageText = MESSAGE_TEXT;
    printf("%s %s\n", messageId, messageText);
}