MQRFH2 structure

The MQRFH2 header contains information about the structure of a message, and its intended consumers, to enable an integration node to process the message and deliver or publish the message to those consumers.

The value 'MQHRF2  ' should be put in the Format field of the preceding header (usually the MQMD). The constant MQFMT_RF_HEADER_2 is defined with this value.

For the C programming language, the constant MQFMT_RF_HEADER_2_ARRAY is also defined. This constant has the same value as MQFMT_RF_HEADER_2, but it is an array of characters, not a character string.

The character set and encoding of the fields in the MQRFH2 header are as follows:

  • Fields other than NameValueData are in the character set and encoding defined by the fields CodedCharSetId and Encoding in the header structure that precedes the MQRFH2 header, or by the same fields in the MQMD structure if the MQRFH2 header is at the start of the application message data. The character set should be one that has single-byte characters for the characters that are valid in queue names.
  • NameValueData is in the character set defined by the NameValueCCSID field. Note that not all Unicode character sets are valid for NameValueCCSID; see the description of NameValueCCSID for details.

    Some character sets have a representation that is dependent on the encoding. If NameValueCCSID defines one of these character sets, NameValueData must be in the same encoding as the other fields in the MQRFH2 header.

  • The user data (if any) that follows NameValueData can be in any supported character set (single-byte, double-byte, or multi-byte), and in any supported encoding.

The MQRFH2 header contains the following fields:

Field Name Description Details
StrucId Structure identifier

The value must be MQRFH_STRUC_ID, which is the identifier for the rules and formatting header structure,.

IBM® App Connect Enterprise populates this field for you if you are constructing an MQRFH2 header in a message flow.

For the C programming language, the constant MQRFH_STRUC_ID_ARRAY is also defined; this constant has the same value as MQRFH_STRUC_ID, but it is an array of characters, not a character string.

Version Structure version number

The value must be MQRFH_VERSION_2, which is the Version-2 rules and formatting header structure.

Struclength Total length of MQRFH2 (including NameValueData)

The initial value of this field is MQRFH_STRUC_LENGTH_FIXED_2, which is the length of the fixed part of the MQRFH2 header structure.

This is the length in bytes of the MQRFH2 header structure, including any NameValueLength and NameValueData fields at the end of the structure.

IBM App Connect Enterprise populates this field for you if you are constructing an MQRFH2 header in a message flow.

There might be more than one pair of these fields at the end of the structure, in the sequence: length1, data1, length2, data2, ....... The length of any user data that follows the last NameValueData field at the end of the structure is not included in StrucLength.

Note: If Struclength is not a multiple of four, problems might occur with the data conversion of user data in some operating system environments.
Encoding Numeric encoding of data that follows NameValueData

The initial value of this field is MQENC_NATIVE.

This field specifies how numeric values in any data that follows the last NameValueData field are represented. This applies to binary integer data, packed decimal integer data and floating-point data.

CodedCharSetId Character set identifier of data that follows NameValueData

The initial value of this field is MQCCSI_INHERIT, which means that the character set identifier is the same as that of the current structure.

This field identifies the coded character set for any character strings in the data that follows the last NameValueData field.

Format Format name of data that follows NameValueData

The initial value of this field is MQFMT_NONE.

This field specifies the format name of any data that follows the last NameValueData field. The name should be padded with blanks to the length of the field.

Note: Do not use a null character to terminate the name before the end of the field; the queue manager does not change to a blank character the null character, or any characters that follow the null character, in the MQRFH2 header.
Note: Do not specify a name with leading or embedded blank characters.
Flags Flags

The initial value of this field is MQRFH_NONE, which means that there are no flags.

NameValueCCSID Character set identifier of NameValueData

The initial value of this field is 1208, which means that the UTF-8 coded character set is used.

This field identifies the coded character set for data in the NameValueData field. This is different from the character set for other character strings in the MQRFH2 header structure, and might be different from the character set for any character data that follows the last NameValueData field.

NameValueCCSID must have one of the following values:

1200: UCS-2 open-ended

1208: UTF-8

13488: UCS-2 2.0 subset

17584: UCS-2 2.1 subset (includes the euro symbol €)

For the UCS-2 character sets, the encoding (byte order) of the NameValueData field must be the same as the encoding of the other fields in the MQRFH2 header structure.

Note: Surrogate characters (X'D800' thru X'DFFF') are not supported.

The following two fields are optional, but if present they must occur as a pair. They can be repeated as a pair as many times as required.

If these fields occur more than once, they must occur in the sequence ..... length1, data1, length2, data2, .......

NameValueLength Length of NameValueData

This field specifies the length, in bytes, of the NameValueData field that follows this field.

IBM App Connect Enterprise populates this field for you if you are constructing an MQRFH2 header in a message flow.

Note: If NameValueLength is not a multiple of four, there might be a problem with the conversion of the data that follows the NameValueData field.
NameValueData This is a variable-length character string containing data that is encoded using an XML-like structure

The length, in bytes, of this string is given by the NameValueLength field that precedes this NameValueData field.

To avoid the problem described in the note accompanying the description of the NameValueLength field, either extend this field with blanks so that its length is a multiple of four, or terminate the field with a null character.

C programming language definition

The following structure is defined in the cmqc.h header file that is supplied with IBM MQ. The constants that are used within the NameValueData field are defined in the BipRfc.h header file that is supplied with IBM App Connect Enterprise.
typedef struct tagMQRFH2 {
  MQCHAR4  StrucId;         /*  Structure identifier                        */
  MQLONG   Version;         /*  Structure version number                    */
  MQLONG   StrucLength;     /*  Total length of MQRFH2 including
                                 NameValueData                              */
  MQLONG   Encoding;        /*  Numeric encoding of data that follows
                                 NameValueData                              */
  MQLONG   CodedCharSetId;  /*  Character set identifier of data that
                                 follows NameValueData                      */
  MQCHAR8  Format;          /*  Format name of data that follows
                                 NameValueData                              */
  MQLONG   Flags;           /*  Flags                                       */
  MQLONG   NameValueCCSID;  /*  Character set identifier of NameValueData   */
 } MQRFH2;