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 » Closed: What is wrong with this mapping node code

Post new topic  Reply to topic
 Closed: What is wrong with this mapping node code « View previous topic :: View next topic » 
Author Message
krypton
PostPosted: Sun May 16, 2010 12:37 am    Post subject: Closed: What is wrong with this mapping node code Reply with quote

Disciple

Joined: 14 Mar 2010
Posts: 186

Quote:
*Line1* CREATE COMPUTE MODULE RouteToparsingError
*Line2* CREATE FUNCTION Main() RETURNS BOOLEAN
*Line3* BEGIN
*Line4* SET OutputRoot = InputRoot;
*Line5* SET OutputLocalEnvironment = InputLocalEnvironment;
*Line6* SET OutputRoot.MQMD = NULL;
*Line7* DECLARE InErrRef REFERENCE TO InputRoot.XMLNSC.XYZ.ERROR_DETAILS;
*Line8* DECLARE InRef REFERENCE TO InputRoot.XMLNSC.XYZ.PARSERFAILURE;
*Line9* IF LASTMOVE(InErrRef) THEN
*Line10* PROPAGATE TO TERMINAL 'out1';
*Line11* RETURN FALSE;
*Line12* ELSEIF LASTMOVE(InRef) THEN
*Line13* PROPAGATE TO TERMINAL 'out2';
*Line14* RETURN FALSE;
*Line15* ELSE
*Line16* PROPAGATE TO TERMINAL 'out';
RETURN FALSE;
END IF;
RETURN TRUE;
END;
END MODULE;


I am trying to propagate a message based on some condition but when the second condition happened means when the Input message is containing
"XYZ.PARSERFAILURE", my message flow is not returning any response to my HTTP reply. I tried to debug it but it just "terminate" the debugger after line 14. I dont know what is the root cause of the problem as if I remove line 12-14, it works fine.


Last edited by krypton on Sat May 22, 2010 3:41 am; edited 2 times in total
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun May 16, 2010 12:55 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

What does a usertrace output tell you?
Sometimes they can be surprisingly enlightening
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
krypton
PostPosted: Sun May 16, 2010 4:18 pm    Post subject: Reply with quote

Disciple

Joined: 14 Mar 2010
Posts: 186

Quote:
What does a usertrace output tell you?


even they are not working in this case
_________________
Dreams are not something which you watch when you are asleep,it is something which doesn't let you sleep.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun May 16, 2010 5:21 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

krypton wrote:
Quote:
What does a usertrace output tell you?


even they are not working in this case


If you can't actually get a user trace out, raise a PMR.

If the user trace (which is something different & better than the debugger I believe you to be using) doesn't give you the answer you're looking for then you should post the relevant section here (using code tags if you don't mind) and we'll look.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
inMo
PostPosted: Wed May 19, 2010 9:26 am    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

Line 14 states "Return False" - Since the statement is in main, the esql's completion is expected.

What are you assuming you are propagating?
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Wed May 19, 2010 10:29 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

Is the out2 terminal of the node wired to anything?

Your ELSE block is also unnecessary. The same functionality is given by the RETURN TRUE statement at the end of your function.
Back to top
View user's profile Send private message
krypton
PostPosted: Thu May 20, 2010 4:45 pm    Post subject: Reply with quote

Disciple

Joined: 14 Mar 2010
Posts: 186

inMo wrote:

Quote:
Line 14 states "Return False" - Since the statement is in main, the esql's completion is expected.

What are you assuming you are propagating?


I am propagating the OutputRoot, but after line 14 the message flows just hangs.


joebuckeye wrote:
Quote:
Is the out2 terminal of the node wired to anything?

Your ELSE block is also unnecessary. The same functionality is given by the RETURN TRUE statement at the end of your function.

Yes, it is wired, and I have removed the last RETURN statement.
[/b]
_________________
Dreams are not something which you watch when you are asleep,it is something which doesn't let you sleep.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Fri May 21, 2010 5:24 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

Quote:
I am propagating the OutputRoot, but after line 14 the message flows just hangs.


What does the command RETURN FALSE do?
Back to top
View user's profile Send private message
krypton
PostPosted: Fri May 21, 2010 6:01 am    Post subject: Reply with quote

Disciple

Joined: 14 Mar 2010
Posts: 186

Thanks joebuckeye, we have resolved the problem. But I am facing another problem related to Conditioning in mapping node .


the scenario is

We have multiple occurence of a source field which is having many subfields, now we need to map it to a subfield of a Target field based on the condition.

Suppose SOURCE Field 'A' is having five occurences with each occurence having subfields 1 to 8, and the Target 'B'(only 1 occurence) is having 7 subfields,
now the objective is to compare
each instances of A6 to B4 and then if they are equal then map A8 to B7.

so, I am trying to run a loop on A using 'for' and then comparing A6 with B4 each time and then IF condition is true , then assign the source A8 to B7. I have return the below code, but it is not working.

Following is the code return in mapping node


Quote:
for$source/A

if
msgmap:occurrence($source/A) = 1 and $source/A/A6= $source_1/B/B4

THEN

source_1/B/B7 = $source/A/A8



But, when I come out the above loop I found the value of B7 equal to fist instance of A8, whereas the condition become true only in the 3rd instance.

what could be wrong here, 'A' is an array but we can not use indexing here like we do in ESQL A[1], A[2] etc.. I can see only the above way to loop but not sure why the first instance is getting assigned instead of assigning the 3rd instance which matches the condition.
_________________
Dreams are not something which you watch when you are asleep,it is something which doesn't let you sleep.
Back to top
View user's profile Send private message
krypton
PostPosted: Fri May 21, 2010 7:54 am    Post subject: Reply with quote

Disciple

Joined: 14 Mar 2010
Posts: 186

Quote:
Thanks joebuckeye, we have resolved the problem. But I am facing another problem related to Conditioning in mapping node .


the scenario is

We have multiple occurence of a source field which is having many subfields, now we need to map it to a subfield of a Target field based on the condition.

Suppose SOURCE Field 'A' is having five occurences with each occurence having subfields 1 to 8, and the Target 'B'(only 1 occurence) is having 7 subfields,
now the objective is to compare
each instances of A6 to B4 and then if they are equal then map A8 to B7.

so, I am trying to run a loop on A using 'for' and then comparing A6 with B4 each time and then IF condition is true , then assign the source A8 to B7. I have return the below code, but it is not working.

Following is the code return in mapping node


Quote:
for$source/A

if
msgmap:occurrence($source/A) = 1 and $source/A/A6= $source_1/B/B4

THEN

source_1/B/B7 = $source/A/A8



But, when I come out the above loop I found the value of B7 equal to fist instance of A8, whereas the condition become true only in the 3rd instance.

what could be wrong here, 'A' is an array but we can not use indexing here like we do in ESQL A[1], A[2] etc.. I can see only the above way to loop but not sure why the first instance is getting assigned instead of assigning the 3rd instance which matches the condition.




I thought someone would reply, as I can not really figure out the way to sort this out.
Is the Subject misleading for this post?? I thought of creating another post with this title, but then it is again the forum rule of Double posting.

May be moderators take notice and can help me.

thanks
_________________
Dreams are not something which you watch when you are asleep,it is something which doesn't let you sleep.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri May 21, 2010 8:01 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

krypton wrote:
I thought someone would reply, as I can not really figure out the way to sort this out.


You'd think that, but it just goes to show.

krypton wrote:
Is the Subject misleading for this post??


Nope, seems fine to me.

krypton wrote:
I thought of creating another post with this title, but then it is again the forum rule of Double posting.


Quite right.

krypton wrote:
May be moderators take notice and can help me.


As I indicated, I don't have any experience with the mapping node to offer, and as a moderator there's not much else to do. If people have something to say, they will. If not, they won't.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fatherjack
PostPosted: Fri May 21, 2010 8:32 am    Post subject: Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

krypton wrote:

Code:
source_1/B/B7 = $source/A/A8



Shouldn't you be setting the $target rather than source?

And I'm with Vitor re. the use of mapping nodes. I'd only use them if it's simple mapping and the source and targets are unlikely to change. Once you get into complex mappings with For loops and If statements it's a bit of a black art to get the mapping code to work as you want. And even when you do, maintenance can be a nightmare. For anything other than straight forward one to one field mapping I'd use ESQL every time.
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
krypton
PostPosted: Fri May 21, 2010 3:57 pm    Post subject: Reply with quote

Disciple

Joined: 14 Mar 2010
Posts: 186

Quote:
krypton wrote:

Code:
source_1/B/B7 = $source/A/A8


fatherjack wrote:

Shouldn't you be setting the $target rather than source?


Yes, I am setting the target only, above is just to represent. Sorry, if it mislead you.

it is same as

target/B/B7 = $source/A/A8

What I can not understand is why the for/If condition is not working.
_________________
Dreams are not something which you watch when you are asleep,it is something which doesn't let you sleep.
Back to top
View user's profile Send private message
krypton
PostPosted: Sat May 22, 2010 3:39 am    Post subject: Reply with quote

Disciple

Joined: 14 Mar 2010
Posts: 186

Quote:
for$source/A

if
msgmap:occurrence($source/A) = 1 and $source/A/A6= $source_1/B/B4

THEN

source_1/B/B7 = $source/A/A8


found out the problem, the line mentioned in RED below was the culprit, obviously if you are having a repeatance of elemenet A, you can not check whether its occurence is 1 (definitely it would be more than that)..

Removed the line, and getting the desired output.


As the issue is resolved now, I will mark this post as "closed"

Thanks to everyone who stopped by this forum.

Warm Regards,
_________________
Dreams are not something which you watch when you are asleep,it is something which doesn't let you sleep.
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 » Closed: What is wrong with this mapping node code
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.