Format of message control information and message data
The queue manager is only interested in the format of the control information within a message, whereas applications that handle the message are interested in the format of both the control information and the data.
Format of message control information
Control information in the character-string fields of the message descriptor must be in the character set used by the queue manager.
The CodedCharSetId attribute of the queue manager object defines this character set. Control information must be in this character set because, when applications pass messages from one queue manager to another, message channel agents that transmit the messages use the value of this attribute to determine what data conversion to perform.
Format of message data
We can specify any of the following things:
- The format of the application data
- The character set of the character data
- The format of numeric data
To do this, use these fields:
- Format
- This indicates to the receiver of a message the format of the application data in the message.
When the queue manager creates a message, in some circumstances it uses the Format field to identify the format of that message. For example, when a queue manager cannot deliver a message, it puts the message on a dead-letter (undelivered message) queue. It adds a header (containing more control information) to the message, and changes the Format field to show this.
The queue manager has a number of built-in formats with names beginning MQ, for example MQFMT_STRING. If these do not meet your needs, we can define your own formats ( user-defined formats ), but we must not use names beginning with MQ for these.
When creating and use your own formats, we must write a data-conversion exit to support a program getting the message using MQGMO_CONVERT.
- CodedCharSetId
- This defines the character set of character data in the message. To set this character set to that of the queue manager, we can set this field to the constant MQCCSI_Q_MGR or MQCCSI_INHERIT.
When you get a message from a queue, compare the value of the CodedCharSetId field with the value that the application is expecting. If the two values differ, you might need to convert any character data in the message or use a data-conversion message exit if one is available.
- Encoding
- This describes the format of numeric message data that contains binary integers, packed-decimal integers, and floating point numbers. It is typically encoded according to the particular machine on which the queue manager is running.
When you put a message on a queue, you typically specify the constant MQENC_NATIVE in the Encoding field. This means that the encoding of our message data is the same as that of the machine on which the application is running.
When you get a message from a queue, compare the value of the Encoding field in the message descriptor with the value of the constant MQENC_NATIVE on your machine. If the two values differ, you might need to convert any numeric data in the message or use a data-conversion message exit if one is available.
- Application data conversion
Application data might need to be converted to the character set and the encoding required by another application where different platforms are concerned.Parent topic: IBM MQ messages