|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
how to access the last two in a chain of exceptions |
« View previous topic :: View next topic » |
Author |
Message
|
pcelari |
Posted: Wed Dec 01, 2010 12:14 pm Post subject: how to access the last two in a chain of exceptions |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
Hi,
the ExceptionList can be very long, containing many subtrees, typically
ExceptionList.parserException.ParserException...ParserException.
But of interest are normally only the last two children in the last layer. I'm thinking to capture only these last two and write to a file or email.
However, without knowing the number of layers, how can I access them?
Can anyone please share some insight?
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
j.f.sorge |
Posted: Wed Dec 01, 2010 1:04 pm Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
I think there was an error handling sample delivered with the toolkit, but you can do it on you're own by using a REFERENCE and move it to the LASTCHILD until you cannot move further. Than go back to the Exception tree you want to store / parse / etc. _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
harish_td |
Posted: Wed Dec 01, 2010 5:56 pm Post subject: |
|
|
Master
Joined: 13 Feb 2006 Posts: 236
|
Code: |
DECLARE ErrorNumber INTEGER 0; /* Error number extracted from exception list */
DECLARE ErrDesc CHARACTER ''; /* Error Description extracted from exception list */
DECLARE ErrType CHARACTER ''; /* Type of Message Broker exception */
-- Declare a reference for the InputExceptionList
DECLARE ptrException REFERENCE TO InputExceptionList.*[1];
WHILE lastmove(ptrException) DO
-- store the current values for the error number and text
IF ptrException.Number is not null THEN
SET ErrorNumber = ptrException.Number;
SET ErrDesc = ptrException.*[<].Text;
--The nature of the exception would be contained in this structure. Print this out to the user
SET ErrType = FIELDNAME(ptrException);
END IF;
-- now move to the last child which should be the next exceptionlist
move ptrException lastchild;
END WHILE; |
|
|
Back to top |
|
 |
pcelari |
Posted: Thu Dec 02, 2010 5:39 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
thanks so much for the input!
here's my code that now works. I didn't realize it could be so simple.
DECLARE start REFERENCE TO InputExceptionList.*[<].*[<];
WHILE start.Number IS NOT NULL DO
-- Move start to the last child of the field to which it currently points
MOVE start LASTCHILD;
END WHILE;
MOVE start PARENT;
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|