|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Multi message copybook message - PROPAGATE |
« View previous topic :: View next topic » |
Author |
Message
|
aspre1b |
Posted: Fri Oct 31, 2008 6:35 am Post subject: Multi message copybook message - PROPAGATE |
|
|
 Voyager
Joined: 05 Jul 2007 Posts: 78 Location: Coventry, UK
|
I’m looking for a little guidance, my scenario is this:
I have a system that kicks out 19 different event messages in cobol copybook format. I have modelled these and I have no problem processing these (I convert them into a canonical XML format and publish them).
I have another type of event message (multi message) that is a concatenation of any of the previous 19 message types. It also has a header (start of the data, not in the usr folder) that describes the number of messages, length of each message and the type of each message.
I have successfully created an MRM to model the multi message format.
[No of types][TypeLength][Type,Length][Type,Length][Type,Length][ FLS DATA / RestMsg]
I plan to chop up the multi message into many messages using PROPAGATE and process them the same as the other 19 event messages. I would prefer to convert each message back into a BLOB and send it back into the event dispatcher.
The alternative was to populate each message type manually, but this would take a while to code.
Sample of my code below:
Code: |
CALL CopyMessageHeaders();
/**********************************************************************************************************************
* msg = length of fixed length message 0000
* restMsg = rest of the message(s) minus the header information which includes the fixed length and data type
* msgType = message type 0000
*
* [No of types][TypeLength][Type,Length][Type,Length][Type,Length][ FLS DATA / RestMsg]
***********************************************************************************************************************/
DECLARE inRef REFERENCE TO InputRoot.MRM;
DECLARE msgLength INTEGER;
DECLARE myChar, restMsg, msgType,messageType CHARACTER;
DECLARE msgSetID,formatType,BH_Class CHARACTER;
DECLARE myBlob,myBlob2 BLOB;
DECLARE blobLength,restMsgLength INTEGER;
DECLARE blobRef REFERENCE TO Environment.BLOB.BLOB;
SET restMsg = inRef.REST;
--Set headRef to the current msg
DECLARE headRef REFERENCE TO inRef.MSG_HEAD[1];
--Cycle through msg headers and extract message from restMsg
WHILE LASTMOVE(headRef) DO
SET msgLength = headRef.MLENGTH;
SET msgType = TRIM(headRef.MTYPE);
--Get current msg from restMsg
SET myChar = SUBSTRING (restMsg FROM 1 FOR msgLength);
SET OutputLocalEnvironment.myChar = myChar; -- maybe not needed
--Perform msgType and msgSet lookup
CALL LookupMsgType(msgType,msgSetID,formatType,BH_Class,messageType);
--Set BH_Class field of the extracted msg
SET "OutputRoot"."MQRFH2"."usr"."BH_Class" = BH_Class;
SET blobLength = 0;
SET restMsgLength = 0;
SET blobLength = LENGTH(blobRef);
SET restMsgLength = LENGTH(inRef.REST);
SET OutputRoot.Properties.MessageDomain = 'BLOB';
--Remove current msg from restMsg
SET restMsg = SUBSTRING(restMsg FROM (msgLength + 1));
--Propagate msg and reset the environment tree
CALL PropagateEnvironment(inRef);
CALL CopyMessageHeaders();
--Move headRef to next msg header
MOVE headRef NEXTSIBLING REPEAT TYPE NAME;
END WHILE;
RETURN FALSE; |
NB: I've got a copy of the original BLOB multi message in the environment tree.
Broker version 5.3 CSD 8
MQ 5 CSD 12
Any help would be appreciated. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|