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 » Looping through the MRM

Post new topic  Reply to topic
 Looping through the MRM « View previous topic :: View next topic » 
Author Message
Segs
PostPosted: Thu Oct 18, 2001 7:16 am    Post subject: Reply with quote

Voyager

Joined: 04 Oct 2001
Posts: 78
Location: Zurich Financial Services

I need to loop round all the data set up in the MRM to check for NULLS prior to passing the message to the output queue. If a NULL is encountered in the MRM is blows up.
Back to top
View user's profile Send private message Send e-mail
Outdesign
PostPosted: Thu Oct 18, 2001 8:28 am    Post subject: Reply with quote

Apprentice

Joined: 16 Sep 2001
Posts: 38
Location: Hampshire, UK

Could you be more specific here ?

A MRM output message does require all fields to be set.

For example, you input message has 5 fields and your output message has 10 fields, you have to assign a default value to the remaining 5 fields.
Back to top
View user's profile Send private message Visit poster's website
Segs
PostPosted: Thu Oct 18, 2001 8:40 am    Post subject: Reply with quote

Voyager

Joined: 04 Oct 2001
Posts: 78
Location: Zurich Financial Services

The problem is caused because the XML passed in may not contain a specific tag. For example if the following is passed:

or

You can use the following statement to correct it:

SET "OutputRoot"."MRM"."CLIENTID" = COALESCE(InputRoot.XML.clientid,'');

but if the tag is missing all together the above statement doesn't work and a NULL is put into the MRM which causes the error. So the question I'm really asking is how to deal with missing tags when populating the MRM.

Does that make more (if any sense)?

Back to top
View user's profile Send private message Send e-mail
Outdesign
PostPosted: Fri Oct 19, 2001 4:58 am    Post subject: Reply with quote

Apprentice

Joined: 16 Sep 2001
Posts: 38
Location: Hampshire, UK

Segs, you need to select the disable HTML option so that we can see your XML message


The COALESCE function returns the first argument that is not null.

In your example I suspect what is happening is that when the element referenced
in the path is missing, you are assigning null by assigning '' (two single quotes
without a space inbetween).

Depending on the datatype of the output field you probably want to assign
a more appropriate default value, like space for character, zero for integer etc.

For example ...

-- assign a default space value for characters
SET OutputRoot.XML.OutMsg.Char1 = COALESCE(InputBody.InMsg.Char1, ' ');

-- assign a default zero value for integers
SET OutputRoot.XML.OutMsg.Int1 = COALESCE(InputBody.InMsg.Int1, 0);

Which is equivalent to ...

IF InputBody.InMsg.Char1 IS NULL THEN
SET OutputRoot.XML.OutMsg.Char1 = ' ';
ELSE
SET OutputRoot.XML.OutMsg.Char1 = InputBody.InMsg.Char1;
END IF;

IF InputBody.InMsg.Int1 IS NULL THEN
SET OutputRoot.XML.OutMsg.Int1 = 0;
ELSE
SET OutputRoot.XML.OutMsg.Int1 = InputBody.InMsg.Int1;
END IF;


I have not tested this, but think this may be the case ...
Back to top
View user's profile Send private message Visit poster's website
Miriam Kaestner
PostPosted: Fri Oct 19, 2001 5:39 am    Post subject: Reply with quote

Centurion

Joined: 26 Jun 2001
Posts: 103
Location: IBM IT Education Services, Germany

COALESCE should work to insert default values.
I have a working flow with this compute node:
DECLARE I INTEGER;
SET I = 1;
WHILE I < CARDINALITY(InputRoot.*[]) DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
SET OutputRoot.Properties.MessageSet = 'DI8MVP807M001';
SET OutputRoot.Properties.MessageType = 'm_Simple_Msg';
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
set OutputRoot.Properties.MessageFormat = 'CWF';
set "OutputRoot"."MRM"."e_Int" = coalesce(InputBody.Field1,1);
set "OutputRoot"."MRM"."e_Str" = coalesce(InputBody.Field2,'');
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Looping through the MRM
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.