Pinned topicDB2_TOKEN_STRING

‏2012-05-24T12:52:50Z
|Tags:

Answered question
This question has been answered.

Unanswered question
This question has not been answered yet.

Hello to all,
I experience difficulty with diagnostic information DB2_TOKEN_STRING. As described, this diagnostic variable contains the message replacement data for a given message.
For testing purposes I wrote a RPG program in which DB2 throws message id SQL0204. This message uses 3 variables of type *char with length *vary.
Here are my problems:
1) First strange thing is that DB2_TOKEN_COUNT is set to 2 (not 3).
2) In DB2_TOKEN_STRING I can see the 3 values as one string but I don't know how to tokenize them. As described, the tokens should be delimited by a hex 'FF' value, so there should be 3 (or at least DB2_TOKEN_COUNT) hex'FF' values but my program finds only 1 hex'FF' value. The program loops DB2_TOKEN_COUNT times, and on every iteration it does a scan function for hex 'FF' on DB2_TOKEN_STRING with the corrected start position.

In IBM i every sql error has its respective message id in message file QSQLMSG.
For sql error -204 there is message id SQL0204.
This message expects 3 substitutions variables: &1(table name), &3(object type), &2(library name).
In order to send/resend a given message to the user/display/log etc. the programmer needs the correct substitutions variables. So the message can be sent, for example, the the previous program call entry by using api QMHSNDPM.
The substitutions variables can be found in SQLERRMC in the SQLCA. SQERRMC has only a length of 70 bytes. Maybe this could not be enough.

Therefore I thought that the information in DB2_TOKEN_STRING would be the same as SQLERRMC in SQLCA.
Maybe I am wrong with my thoughts and the meaning of DB2_TOKEN_STRING is another….
IBM DB2 people say that programmers should better use the informations of the diagnostic area instead of SQLCA.