to the work header, writing messages, message headers, writing, messages, writing a message to the work header, examples" />
Writing a message to the work header
Messages sent to WebSphere MQ for z/OS, which are destined for a queue managed by the z/OS Workload Manager, require a special header. The work header is prefixed to regular message data.
ImqQueueManager mgr ; // The queue manager. ImqQueue queueIn ; // Incoming message queue. ImqQueue queueWLM ; // WLM managed queue. ImqMessage msg ; // Incoming and outgoing message. ImqWorkHeader header ; // Work header information // Retrieve the message to be forwarded. queueIn.setConnectionReference( mgr ); queueIn.setName( MY_QUEUE ); queueIn.get( msg ); // Insert the Work header information. This will vary // the encoding, character set and format of the message. // Message data is moved along, past the header. msg.writeItem( header ); // Send the message to the WLM managed queue. queueWLM.setConnectionReference( mgr ); queueWLM.setName( /* ? */ ); queueWLM.put( msg );