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 » Msg lenght is 0 in MQOutput node

Post new topic  Reply to topic
 Msg lenght is 0 in MQOutput node « View previous topic :: View next topic » 
Author Message
Bravo
PostPosted: Fri Jun 02, 2006 9:39 am    Post subject: Msg lenght is 0 in MQOutput node Reply with quote

Centurion

Joined: 03 Oct 2005
Posts: 146

Hi Everybody,

I am trying to use recusive procedure.Its a simple flow
MQInput -->Compute1-->MQOutput-->Compute2-->MQOutput2 and here is the peice of code.

Code:


CREATE COMPUTE MODULE RESUSE_MSG_FLW_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      DECLARE rOutRoot REFERENCE TO OutputRoot;
      DECLARE rInRoot REFERENCE TO InputRoot;      
      DELETE FIELD rOutRoot.Properties;
       CALL CopyMessageHeaders(rInRoot,rOutRoot);
       DECLARE KeyData CHARACTER;
      SET KeyData = 'Hello ';
      Call createXMLMsg(rInRoot,rOutRoot,KeyData);
       RETURN TRUE;
   END;

END MODULE;


CREATE COMPUTE MODULE RESUSE_MSG_FLW_Compute1
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      DECLARE rOutRoot REFERENCE TO OutputRoot;
      DECLARE rInRoot REFERENCE TO InputRoot;      
      DELETE FIELD rOutRoot.Properties;
      CALL CopyMessageHeaders(rInRoot,rOutRoot);
      DECLARE KeyData CHARACTER;
      SET KeyData = 'Hello ESQL';
      Call createXMLMsg(rInRoot,rOutRoot,KeyData);
      RETURN TRUE;
   END;
   
END MODULE;


CREATE PROCEDURE CopyMessageHeaders(IN rInRoot REFERENCE, IN rOutRoot REFERENCE) BEGIN
      DECLARE I INTEGER;
      DECLARE J INTEGER;
      SET I = 1;
      SET J = CARDINALITY(rInRoot.*[]);
      WHILE I < J DO
         CREATE LASTCHILD OF rOutRoot DOMAIN FIELDNAME(rInRoot.*[I]);
         SET rOutRoot.*[I] = rInRoot.*[I];
         SET I = I + 1;
      END WHILE;
      SET rOutRoot.MQMD.Format = 'MQSTR';
      SET rOutRoot.MQMD.Expiry = -1;
      
END;


CREATE PROCEDURE createXMLMsg(IN rInRoot REFERENCE, INOUT rOutRoot REFERENCE,In KeyData character)
   BEGIN   
      
      SET rOutRoot.XML.Log.InterfaceID = 'TEST';
      SET rOutRoot.XML.Log.IOFlag = 'I';
      SET rOutRoot.XML.Log.RunTimestamp = CURRENT_TIMESTAMP;
      SET rOutRoot.XML.Log.MQMsgID = rInRoot.MQMD.MsgId;
      SET rOutRoot.XML.Log.MQCorelID = rInRoot.MQMD.CorrelId;
      SET rOutRoot.XML.Log.Key = KeyData;

      
      SET rOutRoot.Properties.MessageDomain = 'XML';
   
END;

When I debug mode i can see the whole message in rOutRoot and in OutputRoot but in the MQOutput node,I am getting the message length is 0.

Could you please let me know where am i wrong
_________________
Bravo
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jun 02, 2006 10:01 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://www.mqseries.net/phpBB2/viewtopic.php?p=138110#138110
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Bravo
PostPosted: Fri Jun 02, 2006 10:27 am    Post subject: Reply with quote

Centurion

Joined: 03 Oct 2005
Posts: 146

Thanks for your quick response Jeff..Actually I am not getting problem with the MQMD Header but with body of the message.

In my first post there are two reuse procedures CopyMessageHeaders()
and createXMLMsg() outside the MODULE but with the below code I have CopyMessageHeaders() procedure outside the module and createXMLMsg() is within two compute modules.This works fine..

What am I doing wrong with the first peice of code.

Code:


CREATE COMPUTE MODULE RESUSE_MSG_FLW_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      DECLARE rOutRoot REFERENCE TO OutputRoot;
      DECLARE rInRoot REFERENCE TO InputRoot;       
      DELETE FIELD rOutRoot.Properties;
       CALL CopyMessageHeaders(rInRoot,rOutRoot);
       DECLARE KeyData CHARACTER;
      SET KeyData = 'Hello ';
      Call createXMLMsg();
       RETURN TRUE;
   END;

CREATE PROCEDURE createXMLMsg()
   BEGIN   
       
      SET OutputRoot.XML.Log.InterfaceID = 'TEST';
      SET OutputRoot.XML.Log.IOFlag = 'I';
      SET OutputRoot.XML.Log.RunTimestamp = CURRENT_TIMESTAMP;
      SET OutputRoot.XML.Log.MQMsgID = InputRoot.MQMD.MsgId;
      SET OutputRoot.XML.Log.MQCorelID = InputRoot.MQMD.CorrelId;
      SET OutRoot.XML.Log.Key = KeyData;
      SET OutputRoot.Properties.MessageDomain = 'XML';
   
END;

END MODULE;


CREATE COMPUTE MODULE RESUSE_MSG_FLW_Compute1
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      DECLARE rOutRoot REFERENCE TO OutputRoot;
      DECLARE rInRoot REFERENCE TO InputRoot;       
      DELETE FIELD rOutRoot.Properties;
      CALL CopyMessageHeaders(rInRoot,rOutRoot);
      DECLARE KeyData CHARACTER;
      SET KeyData = 'Hello ESQL';
      Call createXMLMsg(rInRoot,);
      RETURN TRUE;
   END;
   
CREATE PROCEDURE createXMLMsg()
   BEGIN   
       
      SET OutputRoot.XML.Log.InterfaceID = 'TEST';
      SET OutputRoot.XML.Log.IOFlag = 'I';
      SET OutputRoot.XML.Log.RunTimestamp = CURRENT_TIMESTAMP;
      SET OutputRoot.XML.Log.MQMsgID = InputRoot.MQMD.MsgId;
      SET OutputRoot.XML.Log.MQCorelID = InputRoot.MQMD.CorrelId;
      SET OutRoot.XML.Log.Key = KeyData;
      SET OutputRoot.Properties.MessageDomain = 'XML';
   
END;

END MODULE;


CREATE PROCEDURE CopyMessageHeaders(IN rInRoot REFERENCE, IN rOutRoot REFERENCE) BEGIN
      DECLARE I INTEGER;
      DECLARE J INTEGER;
      SET I = 1;
      SET J = CARDINALITY(rInRoot.*[]);
      WHILE I < J DO
         CREATE LASTCHILD OF rOutRoot DOMAIN FIELDNAME(rInRoot.*[I]);
         SET rOutRoot.*[I] = rInRoot.*[I];
         SET I = I + 1;
      END WHILE;
      SET rOutRoot.MQMD.Format = 'MQSTR';
      SET rOutRoot.MQMD.Expiry = -1;
       
END;


Any suggestion
_________________
Bravo
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jun 02, 2006 10:31 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Bravo wrote:
Thanks for your quick response Jeff..Actually I am not getting problem with the MQMD Header but with body of the message.


Yes, but you still aren't creating OutputRoot.XML with the correct parser. So you're having the same problem from the other thread, but with a different child of OutputRoot and a different parser.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jun 02, 2006 10:34 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Also, some general design comments.

You don't ever need to configure more than one MQOutput node to point to the same queue - and it's *slightly* worse if you do so becuase there are more OOProcs. It's also very very confusing to read.

If you need to send more than one message to a queue based on a single input message, then you can use the PROPAGATE esql function.

Secondly, most people use "recursive procedure" to mean a procedure that calls itself. And it doesn't look like your procedures do.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Bravo
PostPosted: Fri Jun 02, 2006 12:09 pm    Post subject: Reply with quote

Centurion

Joined: 03 Oct 2005
Posts: 146

Jeff,

I am using different queues for each MQOutpt nodes.
_________________
Bravo
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jun 02, 2006 1:18 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You could use a distribution list, then.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jun 02, 2006 3:08 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You might try this:
Code:
CREATE PROCEDURE CopyMessageHeaders(IN rInRoot REFERENCE, IN rOutRoot REFERENCE) BEGIN
      DECLARE I INTEGER;
      DECLARE J INTEGER;
      DECLARE myname CHARACTER NULL;
      DECLARE mydname CHARACTER NULL;
      SET I = 1;
      SET J = CARDINALITY(rInRoot.*[]);
      WHILE I < J DO
         SET myname = FIELDNAME(rInRoot.*[I];
         SET mydname = DOMAINNAME(rInRoot.*[I];
         CREATE LASTCHILD OF rOutRoot DOMAIN mydname NAME myname;
         SET rOutRoot.*[I] = rInRoot.*[I];
         SET I = I + 1;
      END WHILE;
      SET rOutRoot.MQMD.Format = 'MQSTR';
      SET rOutRoot.MQMD.Expiry = -1;
      -- add the XML parser
      CREATE LASTCHILD OF rOutRoot DOMAIN 'XML' NAME 'XML'; 
END;


Enjoy -- from memory so no guarantees
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Bravo
PostPosted: Fri Jun 02, 2006 3:17 pm    Post subject: Reply with quote

Centurion

Joined: 03 Oct 2005
Posts: 146

It worked..Thanks Fjb and Jeff for the response.
_________________
Bravo
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jun 02, 2006 3:48 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

fjb_saper wrote:
You might try this:
Code:
      -- add the XML parser
      CREATE LASTCHILD OF rOutRoot DOMAIN 'XML' NAME 'XML';


This is exactly and only the missing piece. And it probably better belongs as the first line of "createXMLMsg" procedure, and not in CopyMessageHeaders.
_________________
I am *not* the model of the modern major general.
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 » Msg lenght is 0 in MQOutput node
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.