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 » How to retrieve Inert.Text from ExceptionList?

Post new topic  Reply to topic
 How to retrieve Inert.Text from ExceptionList? « View previous topic :: View next topic » 
Author Message
tchan
PostPosted: Thu Mar 08, 2012 12:42 pm    Post subject: How to retrieve Inert.Text from ExceptionList? Reply with quote

Newbie

Joined: 16 Feb 2012
Posts: 8

I would like to know if there is a better way in retrieving multiple Insert.Text fields in an ExceptionList tree. The following procedure shows how I've done it, but as you can see the "insertBase" variable below is hard coded. The value "11" is based on the position that I found in the ExceptionList tree. Any better ideas on how to do this more efficiently?

Code:

DECLARE number CHAR;
DECLARE text CHAR;
DECLARE insertText CHAR;
DECLARE insertNo INTEGER;
DECLARE insertBase INTEGER 11;  -- *** hard coded ***
DECLARE ptrException REFERENCE TO InputExceptionList.*[1];

WHILE LASTMOVE(ptrException) DO
IF ptrException.Number IS NOT NULL THEN
   SET number = cast(ptrException.Number as char);
   SET text = ptrException.Text;   
   -- write number and text to somewhere
   set insertNo = insertBase;
   WHILE FIELDNAME(ptrException.*[insertNo]) = 'Insert' do
      SET insertText =  ptrException.*[insertNo].*[2];
      -- write insertText to somewhere
      set insertNo = insertNo + 1;
   end while;
   END IF;
   MOVE ptrException LASTCHILD;
END WHILE;


Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 08, 2012 12:59 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Code:
SELECT ... WHERE FIELDNAME(... ='Insert')...

?
Back to top
View user's profile Send private message
tchan
PostPosted: Thu Mar 08, 2012 2:12 pm    Post subject: Reply with quote

Newbie

Joined: 16 Feb 2012
Posts: 8

What would you put on the left hand side of the parenthesis?

Code:

FIELDNAME(... ='Insert')


Besides, what should I use for the "From" clause in the "Select" statement? I've tried all of the followings, but they all failed.

Code:

Set count = Select count(*) from ptrException;


Code:

Set count = Select count(*) from InputExceptionList;


Code:

Set count = Select count(*) from InputExceptionList.*[1];


Code:

Set count = Select count(*) from InputExceptionList.*[];
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 08, 2012 2:19 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

well, okay, so my code snippet wasn't horribly accurate...
Code:
set Environment.Variables.Inserts=SELECT T.* from InputExceptionLIst.* as T where FIELDNAME(T) LIKE "Insert";


is probably closer to something that might work.
Back to top
View user's profile Send private message
tchan
PostPosted: Fri Mar 09, 2012 6:56 am    Post subject: Reply with quote

Newbie

Joined: 16 Feb 2012
Posts: 8

I've tried your suggestion and put debug on to step through the process, but it didn't return anything even though the ExceptionList does have some Inserts.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 09, 2012 7:00 am    Post subject: Reply with quote

Grand High Poobah

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

tchan wrote:
I've tried your suggestion and put debug on to step through the process


The debugger has a number of limitations, including it's inability to step through a SELECT statement. Take a user trace and see how the SELECT is expanded & resolved.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 09, 2012 7:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
tchan wrote:
I've tried your suggestion and put debug on to step through the process


The debugger has a number of limitations, including it's inability to step through a SELECT statement. Take a user trace and see how the SELECT is expanded & resolved.




Note also that I make no warranties as to the correctness of this code in any way.

It's off the cuff, top of my head, swaggery.
Back to top
View user's profile Send private message
tchan
PostPosted: Fri Mar 09, 2012 8:09 am    Post subject: Reply with quote

Newbie

Joined: 16 Feb 2012
Posts: 8

I performed User Trace, and here's a snapshot of what it says,

Code:

Evaluating expression ''InputExceptionList.*:*'' at ('.ParseExceptionList_Parse_Exception.Parse', '54.55'). This resolved to ''InputExceptionList.*:*''. The result was ''ROW... Root Element Type=16777216 NameSpace='' Name='RecoverableException' Value=NULL''.
Finished evaluating expression ''FIELDNAME(T)'' at ('.ParseExceptionList_Parse_Exception.Parse', '54.87'). The result was '''RecoverableException'''.
Evaluating expression ''FIELDNAME(T) LIKE 'Insert''' at ('.ParseExceptionList_Parse_Exception.Parse', '54.100'). This resolved to '''RecoverableException' LIKE 'Insert' ESCAPE '\'''. The result was ''FALSE''.
('.ParseExceptionList_Parse_Exception.Parse', '54.46') : WHERE clause evaluated to false or unknown.  Iterating FROM clause.
('.ParseExceptionList_Parse_Exception.Parse', '54.46') : There were no items in the FROM clause satisfying the WHERE clause.
Assigning NULL to ''Environment.Variables.Inserts'', thus deleting it.


Thank you for all of your suggestions. I'll continue looking for a better solution.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Mar 09, 2012 8:27 am    Post subject: Reply with quote

Grand High Poobah

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

tchan wrote:
I'll continue looking for a better solution.


Like a SELECT statement that works rather better that this one?

I'd wonder about that FIELDNAME. I'd also wonder if a wildcard might help in the FROM clause.

Moving to your original code, you don't need any hard coded values. Especially as I imagine 11 would not always be the right number. You can itterate (with LASTMOVE) to the base of the exception list. This gives you the "useful" error number and the insert(s) with the text. Obviously you can inspect & optionally record any values on the way down.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
tchan
PostPosted: Fri Mar 09, 2012 9:45 am    Post subject: Reply with quote

Newbie

Joined: 16 Feb 2012
Posts: 8

Instead of using a hard coded value I used the following to verify each sibling of the current exception to locate Insert.Text:

Code:
MOVE myref NEXTSIBLING;


My 2nd version of the procedure is as follows:

Code:

DECLARE number CHAR;
DECLARE text CHAR;
DECLARE ptrException REFERENCE TO InputExceptionList.*[1];

WHILE LASTMOVE(ptrException) DO
IF ptrException.Number IS NOT NULL THEN
   SET number = cast(ptrException.Number as char);
   SET text = ptrException.Text;   
   -- write number and text to somewhere

   -- points to the first sibling of the current exception
   declare myref reference to ptrException.*[1];
   while lastmove(myref) do
       if fieldname(myref) = 'Insert' then
          call writeToLog4j(myref.Text);
      else
         call writeToLog4j('not found ' || 'fieldname = ' || fieldname(myref));
      end if;   
      MOVE myref NEXTSIBLING;
   end while;
END IF;
MOVE ptrException LASTCHILD;
END WHILE;
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 » How to retrieve Inert.Text from ExceptionList?
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.