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 » USING PROPAGATE

Post new topic  Reply to topic
 USING PROPAGATE « View previous topic :: View next topic » 
Author Message
mahek
PostPosted: Tue Mar 01, 2005 2:12 pm    Post subject: USING PROPAGATE Reply with quote

Voyager

Joined: 10 Sep 2004
Posts: 87

Hi all,
I Have the following problem
I HAVE THE INPUT SUPPOSE AS
[1,2]
[2,4]
[1,6]
[2,9]
[1,8]
THE group indicator is [ and terminator is ] AND REPEATING ELEMENTS DELEMITED BY <CR><LF>
I am having a message set in which DETAILS is the repeating element having FIRSTNAME AND LASTNAME AS ITS INNER ELEMENTS.
I have to get the output as
ON QUEUE A
1,2
1,6
1,8
AS ONE MESSAGE

AND ONE QUEUE B
<MESSAGE>
<N>
<FN>2</FN>
<LN>4</LN>
</N>
<N>
<FN>2</FN>
<LN>9</LN>
</N>
</MESSAGE>
I HAVE THE FOLLOWING CODE FOR THIS



CREATE COMPUTE MODULE FLOATMF_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN

DECLARE K INTEGER 1;
DECLARE L INTEGER CARDINALITY(InputRoot.MRM.DETAILS[]);
WHILE K <= L DO
CALL CopyMessageHeaders();
IF InputRoot.MRM.DETAILS[K].FN='1'
THEN
SET OutputRoot.Properties.MessageSet = 'EBQDKJC002001';
SET OutputRoot.Properties.MessageType = 'FLOATMSG1';

SET OutputRoot.MRM.DETAILS[K].FIRSTNAME =InputRoot.MRM.DETAILS[K].FN;
SET OutputRoot.MRM.DETAILS[K].LASTNAME= InputRoot.MRM.DETAILS[K].LN;
SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueName = 'A';
SETOutputLocalEnvironment.Destination.MQ.DestinationData.queueManagerName ='BMB';

ELSE
SET OutputRoot.XML.MESSAGE.N[K].FN=InputRoot.MRM.DETAILS[K].FN;
SET OutputRoot.XML.MESSAGE.N[K].LN=InputRoot.MRM.DETAILS[K].LN;

SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueName 'B;
SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueManagerName= 'BMB';

END IF;
SET K=K+1;
PROPAGATE;
END WHILE;

RETURN FALSE;

END;
Can any one tell me what mistake i am doing.
Thanks
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 01, 2005 2:23 pm    Post subject: Re: USING PROPAGATE Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

mahek wrote:

Can any one tell me what mistake i am doing.
Thanks

Can you tell us what it is doing that you think is wrong?

Can you tell us if you want a total of two output messages, or if you want two output messages per input record?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jwende
PostPosted: Tue Mar 01, 2005 2:41 pm    Post subject: Reply with quote

Novice

Joined: 02 Jul 2001
Posts: 23

I didn't tried this live - but it may look like this ?

DECLARE A,B INTEGER 1;
DECLARE K INTEGER 1;
DECLARE L INTEGER CARDINALITY(InputRoot.MRM.DETAILS[]);

WHILE K <= L DO
IF InputRoot.MRM.DETAILS[K].FN='1'
THEN
SET Environment.A.DETAILS[A].FIRSTNAME =InputRoot.MRM.DETAILS[K].FN;
SET Environment.A..DETAILS[A].LASTNAME= InputRoot.MRM.DETAILS[K].LN;
SET A = A+1;
ELSE
SET Environment.B.MESSAGE.N[B].FN=InputRoot.MRM.DETAILS[K].FN;
SET Environment.B.MESSAGE.N[B].LN=InputRoot.MRM.DETAILS[K].LN;
SET B=B+1;
END IF;
SET K=K+1;
END WHILE;

-- propagate type 1
CALL CopyMessageHeaders();
SET OutputRoot.Properties.MessageSet = 'EBQDKJC002001';
SET OutputRoot.Properties.MessageType = 'FLOATMSG1';
SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueName = 'A';
SETOutputLocalEnvironment.Destination.MQ.DestinationData.queueManagerName ='BMB';
SET OutputRoot.MRM = Environment.A;
PROPAGATE;

--propagate type 2
CALL CopyMessageHeaders();
SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueName 'B;
SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueManagerName= 'BMB';
SET OutputRoot.XML = Environment.B;
PROPAGATE;
Back to top
View user's profile Send private message Send e-mail
mahek
PostPosted: Tue Mar 01, 2005 2:41 pm    Post subject: Reply with quote

Voyager

Joined: 10 Sep 2004
Posts: 87

Hi jefflowrey,
I am trying to get total two output messages here in this example all the records that have the FN =1 ON ONE QUEUE AND all other records whoes FN NOT EQUALS 1 to ANOTHER QUEUE.

I am getting the following error
BROK.AB ) (.FLOATMF_Compute.Main, 23.32) : Invalid indexed assignment to 'DETAILS[K]'.

No indexed elements from the named array exist. In order to assign a value to an element with index n, where 'n' is a positive integer, n-1 elements with the same name must already exist.

Ensure that element n-1 is created before an attempt is made to create element n.
Back to top
View user's profile Send private message
JT
PostPosted: Tue Mar 01, 2005 4:46 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Quote:
Ensure that element n-1 is created before an attempt is made to create element n.

Look at the sample code provided by jwende.

You need to maintain distinct input & output (2) indices.

Your ESQL code attempts to create an output occurrence (does not matter which one) without ever having established the 1st occurrence.
Back to top
View user's profile Send private message
mahek
PostPosted: Wed Mar 02, 2005 9:06 am    Post subject: Reply with quote

Voyager

Joined: 10 Sep 2004
Posts: 87

Hi jwende,

Thanks very much for your help, it works the way you explained.

Once again thanks a lot to you all for the help.
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 » USING PROPAGATE
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.