Message file with a specific CCSID

If the CCSID of the message file is something other than 65535 or 65534, the first- and second-level text of the message description is converted from the CCSID specified to the CCSID of the message file. It is then tagged with the CCSID of the message file.

For example, message file MYMSGF has a CCSID of 00277. The job that is running is in CCSID 00037. You enter the following command:

ADDMSGD MSG('MSG #2') MSGID(TST0002) MSGF(MYMSGF) CCSID(37)

Message 'MSG #2' is converted from CCSID 00037 to CCSID 00277 before it is added to the message file. The number sign (#), X'7B' on code page 00037, is converted to the number sign (#), X'4A', on code page 00277. No other code points change during the conversion because they are the same on both code page 00037 and code page 00277.

When the text of a message description is specified as 65535 and it is added to a message file, no conversion occurs. If the CCSID of the message file is not 65535 or 65534, the message text is tagged with the CCSID of the message file.

When the message file CCSID is not 65535 or 65534, the message file CCSID overrides message description CCSIDs. Keep this rule in mind when adding and changing message descriptions to a message file with a CCSID other than 65535 or 65534. Otherwise, a message description can be marked incorrectly.

For example, message file MYMSGF has a CCSID of 00277. You enter the following command:

ADDMSGD MSG('MSG #2') MSGID(TST0002) MSGF(MYMSGF) CCSID(*HEX)

Message text 'MSG #2' is not converted before it is added to the message file. Because the CCSID of the message file is 00277, the message text is tagged with CCSID 00277.

If the command was run in a job CCSID where the number sign (#) occupies a code point different than the code point for the number signon code page 00277, the message is displayed incorrectly.

A conversion error may occur while adding or changing a message description in a message file. If a conversion error occurs, the message description is still either added to or changed in the message file. The text of the message description, however, is not converted. A diagnostic message is sent and the message description is tagged with the CCSID specified, not with the CCSID of the message file.

When a conversion error occurs, you can recover the correct CCSID tagging for the message description by setting the message file CCSID to 65534. Then you can retrieve the correct CCSID for the message description using the Retrieve Message (RTVMSG) command or the Retrieve Message (QMHRTVM) API.

The CCSID of a message description applies only to first- and second-level message text.

Related reference
Retrieve Message (RTVMSG) command
Retrieve Message (QMHRTVM) API