When you construct MQRFH2 headers in a
Compute node, there are two types of fields:
- Fields in the MQRFH2 header structure; for example, Format and NameValueCCSID.
- Fields in the MQRFH2 NameValue buffer; for example, mcd and psc.
To differentiate between these two field types, insert a value in
front of the referenced field in the MQRFH2 field to identify its type; a
value for the NameValue buffer is not required because this is the default.
The value that you specify for the header structure is (MQRFH2.Field).
For
example:
- To create or change an MQRFH2 Format field, specify the following ESQL:
SET OutputRoot.MQRFH2.(MQRFH2.Field)Format = 'MQSTR ';
- To create or change the psc folder with a topic:
SET OutputRoot.MQRFH2.psc.Topic = 'department';
- To add an MQRFH2 header to an outgoing message that is to be used to make
a subscription request:
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Version = 2;
SET OutputRoot.MQRFH2.(MQRFH2.Field)Format = 'MQSTR';
SET OutputRoot.MQRFH2.(MQRFH2.Field)NameValueCCSID = 1208;
SET OutputRoot.MQRFH2.psc.Command = 'RegSub';
SET OutputRoot.MQRFH2.psc.Topic = "InputRoot"."MRM"."topel";
SET OutputRoot.MQRFH2.psc.QMgrName = 'DebugQM';
SET OutputRoot.MQRFH2.psc.QName = 'PUBOUT';
SET OutputRoot.MQRFH2.psc.RegOpt = 'PersAsPub';
Note the use of a variable, J, initialized to the value of the cardinality
of the existing headers in the message. This is more efficient than calculating
the cardinality on each iteration of the loop, which happens if you code the
following WHILE statement:
WHILE I < CARDINALITY(InputRoot.*[]) DO

The MQRFH2 header can be parsed using either the
MQRFH2 parser or the MQRFH2C compact parser. To consume less memory, use the
MQRFH2C compact parser by selecting the
Use MQRFH2C compact parser
for MQRFH2 Header check box on the input node of the message flow.
This results in paths that contain MQRFH2C instead of MQRFH2; for example:
SET
OutputRoot.MQRFH2C.psc.Topic = 'department';

Target MQRFH2 fields are created only if the headers are copied,
and the MQRFH2C parser option is not selected on the MQInput node. In all
other circumstances, an MQRFH2C field is created on output.
