Db2 MQ CCSID conversion

When a message is sent, the message sent may be converted to the job CCSID by DB2®. When a message is read or received, it may be converted to a specified CCSID by Websphere MQ.

The msg-data parameter on the MQSEND function is defined to be in the job CCSID. If a string is passed for msg-data, it will be converted to the job CCSID. For example, if a string is passed for msg-data that has a CCSID 1200, it will be converted to the job CCSID before the message data is passed to Websphere MQ. If the string is defined to be bit data or the CCSID of the string is the job CCSID, no conversion will occur.

Websphere MQ does not perform CCSID conversions of the message data when MQSEND is executed. The message data passed from Db2 will be sent unchanged along with a CCSID which will inform the receiver of the message how to interpret the message data. The CCSID that is sent depends on the value specified for the CODEDCHARSETID of the service used on the MQSEND function. The default for CODEDCHARSETID is -3 which indicates that the CCSID passed will be the job default CCSID. If a value other then -3 is used for CODEDCHARSETID, the invoker must ensure that the message data passed to MQSEND will not get converted to the job CCSID by Db2 and that the string is encoded in that specified CCSID.

When a message is read or received by a Db2 MQ scalar or table function, the msg-data return parameter (and the MSG result column for the Db2 MQ table functions) are also defined be in job default CCSID. Db2 does no conversions and relies on Websphere MQ to perform any necessary conversions. Whether Websphere will convert the message data can be controlled by setting the RCV_CONVERT value to 'N' in the specified policy.

If the specified service has a value for CODEDCHARSETID of -3, Db2 will instruct Websphere MQ to convert any message read or received into the job CCSID. If a value other then -3 is used for CODEDCHARSETID, Db2 will instruct Websphere MQ to convert any message read or received into that CCSID. Specifying something other than -3 for CODEDCHARSETID in a service used to read or receive messages is not recommended since the msg-data return parameter and MSG result column are defined by Db2 to be in job default CCSID.

When reading or receiving a message, truncation may occur. If the specified policy has a value for RCV_ACCEPT_TRUNC_MSG of 'Y', the message may be truncated without any warning. If the value for RCV_ACCEPT_TRUNC_MSG is 'N' and the message is too long, the function ends with an error.