When a message is sent to the message queue and the CCSID of the message queue is something other than 65535 or 65534, the replacement data or immediate message text is converted to the CCSID of the message queue. The message is then tagged with the CCSID of the message queue.
For example, message queue MYMSGQ has a CCSID of 00277. The replacement data for TST0002 is defined as *CCHAR data. You enter the following Send Program Message command:
SNDPGMMSG MSGDTA(X'0006D4E2C7407BF2') MSGID(TST0002) MSGF(MYMSGF) CCSID(37) TOMSGQ(MYLIB/MYMSGQ)
The replacement data is converted from CCSID 00037 to CCSID 00277 before it is sent to the message queue. X'0006' is the length required for variable-length fields. X'D4E2C7407BF2' is MSG #2 on code page 00037. The number sign (#), X'7B' on code page 00037, is converted to a number sign, X'4A' on code page 00277. All other code points do not change during the conversion because they are the same on both code page 00037 and code page 00277.
When the replacement data or immediate message text of a message is 65535 and it is sent to a message queue with a CCSID other than 65535 or 65534, no conversion occurs. However, the message is tagged with the CCSID of the message queue. Therefore, messages can be tagged with an incorrect CCSID when you send them to a message queue with a CCSID that overrides the message-level CCSID.
For example, message queue MYMSGQ has a CCSID of 00277. You enter the following Send Message command:
SNDMSG MSG('MSG #2') TOMSGQ(MYLIB/MYMSGQ) CCSID(*HEX)
The immediate message text MSG #2 is not converted before it is sent to the message queue. Although the immediate message text is not converted to CCSID 00277, it is displayed using CCSID 00277. Unless you entered the Send Message command from a device configured to support code page 00277, you lost the integrity of the immediate message text.