|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
MRM message question |
« View previous topic :: View next topic » |
Author |
Message
|
kirani |
Posted: Tue Mar 12, 2002 2:49 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Alison,
Did my ESQL helped you in solving this problem?
|
|
Back to top |
|
 |
KittieKat |
Posted: Wed Mar 13, 2002 10:10 am Post subject: |
|
|
Apprentice
Joined: 17 Dec 2001 Posts: 31
|
Hi Kiran,
It works very well! Thanks so much.
-Alison |
|
Back to top |
|
 |
kirani |
Posted: Wed Mar 13, 2002 11:48 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
For those of you who want to know how it is done in ESQL!!
MQInput->Compute->MQOutput
In your MQInput node, set message domain to BLOB. Add following code into a compute node. Make sure you select 'Copy Message Headers only' in Compute node.
DECLARE MSGBDY CHAR;
DECLARE NEWMSGBDY CHAR;
DECLARE MSGLEN INT;
DECLARE F1DATA BLOB;
DECLARE F2DATA BLOB;
DECLARE F3DATA BLOB;
DECLARE F4DATA BLOB;
DECLARE F5DATA BLOB;
DECLARE F6DATA BLOB;
DECLARE F7DATA BLOB;
DECLARE F8DATA BLOB;
DECLARE F9DATA BLOB;
DECLARE DATALEN INT;
DECLARE STARTPOS INT;
DECLARE ENDPOS INT;
DECLARE CNT INT;
DECLARE NEXTSTARTPOS INT;
DECLARE PREFDATA BLOB;
DECLARE SUFDATA BLOB;
DECLARE DELIMITCHAR BLOB;
-- Set Prefix char in hex, currently set to :
SET PREFDATA = X'3a';
-- Set Sufix char in hex, currently set to :
SET SUFDATA = X'3a';
-- Set field delimiter, currently set to | character
SET DELIMITCHAR = X'7c';
-- Get incoming message length
SET MSGLEN = LENGTH(CAST(InputRoot."BLOB"."BLOB"AS CHAR));
-- Get Message Body
SET MSGBDY = SUBSTRING(CAST(InputRoot."BLOB"."BLOB" AS CHAR) FROM 3 FOR MSGLEN);
-- Init counter
SET CNT = 1;
-- While loop (input number of fields)
WHILE (CNT <= 9) DO
-- Determine starting position
SET STARTPOS = 1;
-- Find ending position of field, 7C is hex value for | character
SET ENDPOS = POSITION( DELIMITCHAR IN MSGBDY);
-- Determine field length
SET DATALEN = ENDPOS - STARTPOS;
-- Extract each field into BLOB variable with prefix and sufix attached to it.
EVAL ('SET F' || CAST(CNT AS CHAR) || 'DATA = PREFDATA || CAST(SUBSTRING(MSGBDY FROM STARTPOS FOR DATALEN) AS BLOB) || SUFDATA;');
-- Next field starting position. Depending on your field delimiter change the numeric figure.
SET NEXTSTARTPOS = ENDPOS + 2 ;
-- Remove extracted field from buffer.
SET MSGBDY = SUBSTRING(MSGBDY FROM NEXTSTARTPOS );
-- incremement field counter
SET CNT = CNT + 1;
END WHILE;
-- Create output BLOB message.
SET OutputRoot."BLOB"."BLOB" = F1DATA || F2DATA || F3DATA || F4DATA || F5DATA || F6DATA || F7DATA || F8DATA || F9DATA;
If you send following message as input to this compute node,
AAA|BBB|CCC|DDD|EEE|FFF|GGG|HHH|III|
it generates following output message:
:AAA::BBB::CCC::DDD::EEE::FFF::GGG::HHH::III:
Kiran |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|