ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CDataSection Designation Disappearing(Resolved)

Post new topic  Reply to topic
 CDataSection Designation Disappearing(Resolved) « View previous topic :: View next topic » 
Author Message
wraymore
PostPosted: Wed Dec 20, 2006 1:05 pm    Post subject: CDataSection Designation Disappearing(Resolved) Reply with quote

Centurion

Joined: 16 Aug 2005
Posts: 114
Location: Burlington, NC USA

On WBIMB v5 FixPack 6.

Have a project to decompose large messages that contain instances of smaller messages. I created message flow with the following esql and it works:

DECLARE Specimen_Cnt INTEGER;
DECLARE L INTEGER 1;
-- DECLARE xmlns NAMESPACE 'http://www.xmlns.com';
-- DECLARE dt NAMESPACE 'urn:schemas-microsoft-com:datatype';
-- Find number of individual specimen reports

SET Specimen_Cnt =
CARDINALITY(InputRoot.XML.REPORT.REPORT_INFO.SPECIMENS[]);
SET OutputLocalEnvironment.ScratchPad.Specimen_Cnt = Specimen_Cnt;

-- Loop through the batch result reports message to build the individual
-- result report messages

WHILE L <= Specimen_Cnt DO
CALL CopyMessageHeaders();

--Copy the Properties file

SET OutputRoot.Properties = InputRoot.Properties;

-- Remove references to message set

DECLARE Prprts REFERENCE TO OutputRoot.Properties;
SET Prprts.MessageSet = '';
SET Prprts.MessageType = '';
SET Prprts.MessageFormat = '';
SET OutputRoot.MQRFH2.Format = 'MQSTR ';

-- Build the MQRFH2 usr Folder

CALL BuildRFH2USR();

-- Build the decomposed individual result report messages

SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) =
InputRoot.XML.(XML.XmlDecl).(XML.Version);
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML."Encoding") = 'UTF-8';
SET OutputRoot.XMLNS.REPORT.(XML.Attribute)file_version =
InputRoot.XML.REPORT.(XML.Attribute)file_version;
SET OutputRoot.XMLNS.REPORT.(XML.NamespaceDecl)xmlns:dt = 'urn:schemas-microsoft-com:datatype';
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.(XML.Attribute)Report_Type =
InputRoot.XML.REPORT.REPORT_INFO.(XML.Attribute)Report_Type;
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.XML_VERSION =
InputRoot.XML.REPORT.REPORT_INFO.XML_VERSION;
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.ACK_SEGMENT =
InputRoot.XML.REPORT.REPORT_INFO.ACK_SEGMENT;
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.FSA_SEGMENT =
InputRoot.XML.REPORT.REPORT_INFO.FSA_SEGMENT;
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.FSF_SEGMENT =
InputRoot.XML.REPORT.REPORT_INFO.FSF_SEGMENT;
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.SPECIMENS =
InputRoot.XML.REPORT.REPORT_INFO.SPECIMENS[L];
PROPAGATE; -- releases message to next step
SET L = L + 1;
END WHILE;

RETURN FALSE; -- this keeps last message from being duplicated
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;

CREATE PROCEDURE BuildRFH2USR() BEGIN
DECLARE InUsrFolder REFERENCE TO InputRoot.MQRFH2.usr;
DECLARE OutUsrFolder REFERENCE TO OutputRoot.MQRFH2.usr;
SET OutUsrFolder = NULL;
SET OutUsrFolder.RoutingProcessId = 'LCM_PDF_RESULT_CHOPPED';
SET OutUsrFolder.RoutingMessageType = InUsrFolder.RoutingMessageType;
SET OutUsrFolder.RoutingMessageFormat = InUsrFolder.RoutingMessageFormat;
SET OutUsrFolder.RoutingOriginatingSystem = InUsrFolder.RoutingOriginatingSystem;
SET OutUsrFolder.RoutingDestinationSystem = 'MOBIUS';

END;


Then was reading some items on this forum and came across a link to a report by Dominic Storey; Reducing memory usage in WebSphere Business Integration Message Broker Splitting large messages using ESQL in WebSphere Business Integration Message Broker

So I wrote the following esql:

DECLARE ScratchPad REFERENCE TO Environment.ScratchPad;

-- Copy the input tree, backed by the bitstream, to the environment
-- Set a message pointer to this copied message tree
SET Environment.Variables.InputRoot = InputRoot.XML;
DECLARE InMessageCopy REFERENCE TO Environment.Variables.InputRoot;

-- Shortcuts to our input and output message
DECLARE InputMessage REFERENCE TO InMessageCopy;

-- Declare a variable which relates to the number of the Inner
-- Message we are currently processing. This is useful for reporting
-- the number of messages we have processed.
DECLARE Inner_No INTEGER 0;

-- Move onto the first Inner Message ready to begin processing them
MOVE InputMessage FIRSTCHILD NAME 'REPORT';
MOVE InputMessage FIRSTCHILD NAME 'REPORT_INFO';
MOVE InputMessage FIRSTCHILD NAME 'ACK_SEGMENT';
SET ScratchPad.ACK_SEGMENT = InputMessage;
MOVE InputMessage NEXTSIBLING NAME 'FSA_SEGMENT';
SET ScratchPad.FSA_SEGMENT = InputMessage;
MOVE InputMessage NEXTSIBLING NAME 'FSF_SEGMENT';
SET ScratchPad.FSF_SEGMENT = InputMessage;
MOVE InputMessage NEXTSIBLING NAME 'SPECIMENS';
WHILE LASTMOVE(InputMessage)
DO
CASE FIELDNAME(InputMessage)
WHEN 'SPECIMENS' THEN
IF Inner_No >=1 THEN
DELETE PREVIOUSSIBLING OF InputMessage;
END IF;
SET Inner_No = Inner_No + 1;
CALL CopyMessageHeaders();
--Copy the Properties file
SET OutputRoot.Properties = InputRoot.Properties;
-- Remove references to message set
DECLARE Prprts REFERENCE TO OutputRoot.Properties;
SET Prprts.MessageSet = '';
SET Prprts.MessageType = '';
SET Prprts.MessageFormat = '';
SET OutputRoot.MQRFH2.Format = 'MQSTR ';
-- Build the MQRFH2 usr Folder
CALL BuildRFH2USR();
-- Compose Specimen Result Report Message
SET OutputRoot.XMLNS.(XML.XmlDecl) = '';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML."Encoding") = 'UTF-8';
SET OutputRoot.XMLNS.REPORT.(XML.Attribute)file_version = '1';
SET OutputRoot.XMLNS.REPORT.(XML.NamespaceDecl)xmlns:dt = 'urn:schemas-microsoft-com:datatype';
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.(XML.Attribute)Report_Type = '01';
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.XML_VERSION = '1.0';
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.ACK_SEGMENT = ScratchPad.ACK_SEGMENT;
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.FSA_SEGMENT = ScratchPad.FSA_SEGMENT;
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.FSF_SEGMENT = ScratchPad.FSF_SEGMENT;
SET OutputRoot.XMLNS.REPORT.REPORT_INFO.SPECIMENS = InputMessage;
-- Propagate the Inner message
PROPAGATE;
END CASE;
MOVE InputMessage NEXTSIBLING NAME 'SPECIMENS';
END WHILE;

RETURN FALSE;
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;

CREATE PROCEDURE BuildRFH2USR() BEGIN
DECLARE InUsrFolder REFERENCE TO InputRoot.MQRFH2.usr;
DECLARE OutUsrFolder REFERENCE TO OutputRoot.MQRFH2.usr;
-- SET OutUsrFolder = NULL;
SET OutUsrFolder.RoutingProcessId = 'LCM_PDF_RESULT_CHOPPED';
SET OutUsrFolder.RoutingMessageType = InUsrFolder.RoutingMessageType;
SET OutUsrFolder.RoutingMessageFormat = InUsrFolder.RoutingMessageFormat;
SET OutUsrFolder.RoutingOriginatingSystem = InUsrFolder.RoutingOriginatingSystem;
SET OutUsrFolder.RoutingDestinationSystem = 'MOBIUS';

END;

Sample Input:

<?xml version="1.0" ?>
<REPORT file_version="1" xmlns:dt="urn:schemas-microsoft-com:datatypes">
<REPORT_INFO Report_Type="01">
<XML_VERSION>1.00</XML_VERSION>
<ACK_SEGMENT><![CDATA[ACK|ACKDOC|JMB1|205|002|104154||RTLCS9|385119|JMBLCM|R|BITTEJ|205|G|RHLALCM*|20510001JMB1||||| ]]></ACK_SEGMENT>
<FSA_SEGMENT><![CDATA[FSA|N|3|7|1|0|0|80|C||deadbeef|N|1|1|Y|Y| |N|N|Y|| ]]></FSA_SEGMENT>
<FSF_SEGMENT><![CDATA[FSF|REPORT3|YES|CUSTTED|14|3700|NCB13|NCB|678023|JMBLCM|R|PO|JMB1||205|104154|385119|2782|8002227566|BITTEJ|BITTENJ@LABCORP.COM|LABCORP|3364360553||ISO PROGRAMMING DEPT|(NCB)BURLINGTON NC^1447 YORK COURT^BURLINGTON, NC 27215^8007624344|00199060020^00199060010|002|20510001JMB1|9|SOC|ACKDOC|20060724|LT90|LCM||CHLALCM*20510001JMB1|RHLALCM*20510001JMB1||G|||03.17.03|||| ]]></FSF_SEGMENT>
<SPECIMENS Specimen="00199060020">
<MSH_SEGMENT Specimen="00199060020"><![CDATA[MSH|^~\&|1100|PO|LCM|50|200607241041||ORU|2782|P|1-00-2004|N||N|3||N|| ]]></MSH_SEGMENT>
...

Sample Output from the first eqsl listing:

<?xml version="1.0" encoding="UTF-8"?>
<REPORT file_version="1" xmlns:dt="urn:schemas-microsoft-com:datatype">
<REPORT_INFO Report_Type="01">
<XML_VERSION>1.00</XML_VERSION>
<ACK_SEGMENT><![CDATA[ACK|ACKDOC|JMB1|205|002|104154||RTLCS9|385119|JMBLCM|R|BITTEJ|205|G|RHLALCM*|20510001JMB1||||| ]]></ACK_SEGMENT>
<FSA_SEGMENT><![CDATA[FSA|N|3|7|1|0|0|80|C||deadbeef|N|1|1|Y|Y| |N|N|Y|| ]]></FSA_SEGMENT>
<FSF_SEGMENT><![CDATA[FSF|REPORT3|YES|CUSTTED|14|3700|NCB13|NCB|678023|JMBLCM|R|PO|JMB1||205|104154|385119|2782|8002227566|BITTEJ|BITTENJ@LABCORP.COM|LABCORP|3364360553||ISO PROGRAMMING DEPT|(NCB)BURLINGTON NC^1447 YORK COURT^BURLINGTON, NC 27215^8007624344|00199060020^00199060010|002|20510001JMB1|9|SOC|ACKDOC|20060724|LT90|LCM||CHLALCM*20510001JMB1|RHLALCM*20510001JMB1||G|||03.17.03|||| ]]></FSF_SEGMENT>
<SPECIMENS Specimen="00199060020">
<MSH_SEGMENT Specimen="00199060020"><![CDATA[MSH|^~\&|1100|PO|LCM|50|200607241041||ORU|2782|P|1-00-2004|N||N|3||N|| ]]></MSH_SEGMENT>
...

Sample Output from second esql listing:

<?xml version="1.0" encoding="UTF-8"?>
<REPORT file_version="1" xmlns:dt="urn:schemas-microsoft-com:datatype">
<REPORT_INFO Report_Type="01">
<XML_VERSION>1.0</XML_VERSION>
<ACK_SEGMENT>ACK|ACKDOC|JMB1|205|002|104154||RTLCS9|385119|JMBLCM|R|BITTEJ|205|G|RHLALCM*|20510001JMB1|||||..</ACK_SEGMENT>
<FSA_SEGMENT>FSA|N|3|7|1|0|0|80|C||deadbeef|N|1|1|Y|Y| |N|N|Y||..</FSA_SEGMENT>
<FSF_SEGMENT>FSF|REPORT3|YES|CUSTTED|14|3700|NCB13|NCB|678023|JMBLCM|R|PO|JMB1||205|104154|385119|2782|8002227566|BITTEJ|BITTENJ@LABCORP.COM|LABCORP|3364360553||ISO PROGRAMMING DEPT|(NCB)BURLINGTON NC^1447 YORK COURT^BURLINGTON, NC 27215^8007624344|00199060020^00199060010|002|20510001JMB1|9|SOC|ACKDOC|20060724|LT90|LCM||CHLALCM*20510001JMB1|RHLALCM*20510001JMB1||G|||03.17.03||||..</FSF_SEGMENT>
<SPECIMENS>
<Specimen>00199060020</Specimen>
<MSH_SEGMENT>MSH|^~\&amp;|1100|PO|LCM|50|200607241041||ORU|2782|P|1-00-2004|N||N|3||N||..</MSH_SEGMENT>
...

The issue is in the second output the CDATA tags have disappeared and the XML.Attribute Specimen from the SPECIMENS tag has been changed to a child element and is missing from the MSH_SEGMENT.[/b]


Last edited by wraymore on Thu Dec 21, 2006 7:59 am; edited 1 time in total
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Dec 20, 2006 1:34 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You didn't create your Environment trees to have any associated parser.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wraymore
PostPosted: Thu Dec 21, 2006 5:45 am    Post subject: CDataSection Designation Disappearing (Resolved) Reply with quote

Centurion

Joined: 16 Aug 2005
Posts: 114
Location: Burlington, NC USA

Thanks Jeff. Added the CREATE LASTCHILD OF Environment DOMAIN 'XML' NAME 'Variable Name'.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Dec 21, 2006 5:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Please don't use the XML domain.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wraymore
PostPosted: Thu Dec 21, 2006 6:41 am    Post subject: Reply with quote

Centurion

Joined: 16 Aug 2005
Posts: 114
Location: Burlington, NC USA

Okay, Switched to DOMAIN XMLNS
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CDataSection Designation Disappearing(Resolved)
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.