Author |
Message
|
scorpio9 |
Posted: Tue May 15, 2012 11:19 am Post subject: Access MQ Reason Code and Completion Code in exception tree |
|
|
 Newbie
Joined: 15 May 2012 Posts: 5 Location: NJ
|
Hi,
I have to build a MQ Exception Tree something like below for error handling in ESQL:
WHEN FIELDNAME(RefException) = 'MessageException' THEN
SET ENV.MQE.NUMBER = RefException.Number;
SET ENV.MQE.TEXT = RefException.Text;
SET ENV.MQE.COMPCD = RefException.Insert[1].Text;
SET ENV.MQE.REASONCD = RefException.Insert[3].Text;
My question is...what is the best way to access the MQRC & MQCC from the exception tree whenever I get a MQ exception and build my Exception Tree as above? I observed the position of them varies in the Insert tree based on the BIPMsg number.
Thanks in advance. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue May 15, 2012 11:22 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
scorpio9 |
Posted: Tue May 15, 2012 11:48 am Post subject: |
|
|
 Newbie
Joined: 15 May 2012 Posts: 5 Location: NJ
|
thank you, but how do I write the Select query when I dont know in which Insert element tree the reason code is returned for each MQ exception?
problem is the reason code can come in Insert[1], Insert[2], Insert[3],...for different MQ exceptions. how can I capture that every time in my code? |
|
Back to top |
|
 |
mqjeff |
Posted: Tue May 15, 2012 11:58 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Select the insert that contains the Reason Code.
That is, write a WHERE clause that identifies that a specific insert contains a Reason Code. |
|
Back to top |
|
 |
scorpio9 |
Posted: Tue May 15, 2012 12:38 pm Post subject: |
|
|
 Newbie
Joined: 15 May 2012 Posts: 5 Location: NJ
|
how do I find the Insert that contains a Reason code? the Insert tree doesnt have anything to identify it, all it has is the four digit number(RC). The only way to write a WHERE condition is to look for four digit number which I think is not a good approach.
Also what about the completion code? |
|
Back to top |
|
 |
scorpio9 |
Posted: Tue May 15, 2012 1:54 pm Post subject: |
|
|
 Newbie
Joined: 15 May 2012 Posts: 5 Location: NJ
|
Okay, got what you were talking about. let me try that. thanks! |
|
Back to top |
|
 |
scorpio9 |
Posted: Thu May 17, 2012 6:17 am Post subject: |
|
|
 Newbie
Joined: 15 May 2012 Posts: 5 Location: NJ
|
I have written my select statement something like this to find the reason cd and completion cd...
IF FIELDNAME(PATH) = 'Insert' THEN
MOVE PATH PARENT;
SET ENV.MQE.REASONCD[] = SELECT P.Text FROM PATH.Insert[] AS P WHERE (P.Text) => 2000 AND (P.Text) < 6130;
SET ENV.MQE.COMPCD[] = SELECT P.Text FROM PATH.Insert[] AS P WHERE (P.Text = 1 OR P.Text = -1 OR P.Text = 2) ;
END IF;
It works as long as there is an integer in the Insert.Text and fails when it comes across a char. Is there better way I can find the MQRC & MQCC using a Select query?
The other way I thought of doing this is using a while loop and traverse though each Insert.Text and find if it is an integer, if so, is it => 2000 & <6130 for MQRC. By doing this I am only trying to find any integer in Insert.Text which is between the range of 2000 - 6130...which has a risk that it might not be a MQRC or MQCC.
I want to capture the MQRC & MQCC for anykind of MQ exceptions and map it to my tree. Appreciate any ideas. |
|
Back to top |
|
 |
|