Author |
Message
|
latitude |
Posted: Tue Aug 25, 2009 3:55 am Post subject: Error Handler Issue |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
All,
Im having a little trouble with the following code and wonder if anyone could spot the issue please. I’m working with an error handler and using the following ESQL procedure. When I get the EXCEPTION 1, it works properly and generates the outgoing message as per the code but when the EXCEPTION 2 occurs, error handler fails and generates EXCEPTION 3.
Thanks
Quote: |
CREATE PROCEDURE ErrorConstructor() BEGIN
DECLARE Error INTEGER;
DECLARE Text CHARACTER;
DECLARE Place INTEGER;
DECLARE LastPlace INTEGER;
DECLARE NodeName CHARACTER;
DECLARE Label CHARACTER;
DECLARE FlowName CHARACTER;
DECLARE start REFERENCE TO InputExceptionList.*[1];
WHILE start.Number IS NOT NULL DO
SET Error = start.Number;
IF Error >= 6000 THEN
SET Text = SUBSTRING(start.Insert.Text FROM 1 FOR 250);
ELSE
SET Text = SUBSTRING(start.Text FROM 1 FOR 250);
END IF;
SET Label = start.Label;
SET Place = POSITION('.' IN Label);
SET LastPlace = Place;
WHILE Place <> 0 DO
SET Label=SUBSTRING(Label FROM (Place+1));
SET Place=POSITION('.' IN Label);
SET LastPlace = LastPlace + Place;
END WHILE;
SET Label=start.Label;
SET FlowName=SUBSTRING(Label FROM 1 FOR (LastPlace-1));
SET NodeName=SUBSTRING(Label FROM (LastPlace+1));
MOVE start LASTCHILD;
END WHILE;
-- Construct outgoing error message
SET OutputRoot.MQMD = InputRoot.MQMD;
SET OutputRoot.XMLNSC.ValidationError.ErrorOccuredAt = CURRENT_TIMESTAMP;
SET OutputRoot.XMLNSC.ValidationError.MessageId = InputRoot.MQMD.MsgId;
SET OutputRoot.XMLNSC.ValidationError.NodeName = NodeName;
SET OutputRoot.XMLNSC.ValidationError.FlowName = FlowName;
SET OutputRoot.XMLNSC.ValidationError.ErrorNumber = Error;
SET OutputRoot.XMLNSC.ValidationError.ErrorMessage = Text;
END; |
EXCEPTION 1
Quote: |
ExceptionList
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbFilterNode.cpp
Line:INTEGER:285
Function:CHARACTER:ImbFilterNode::evaluate
Type:CHARACTER:ComIbmFilterNode
Name:CHARACTER:MyFlow#FCMComposite_1_5
Label:CHARACTER:MyFlow.InputMessageValidator
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp
Line:INTEGER:602
Function:CHARACTER:SqlStatementGroup::execute
Type:CHARACTER:ComIbmFilterNode
Name:CHARACTER:MyFlow#FCMComposite_1_5
Label:CHARACTER:MyFlow.InputMessageValidator
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2488
Text:CHARACTER:Error detected, rethrowing
Insert
Type:INTEGER:5
Text:CHARACTER:.MyFlow_InputMessageValidator.Main
Insert
Type:INTEGER:5
Text:CHARACTER:22.8
Insert
Type:INTEGER:5
Text:CHARACTER:THROW EXCEPTION CATALOG 'Validation Error' MESSAGE 7000 VALUES( 'Please check the Field A. It is a mandotory field');
UserException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlThrowExceptionStatements.cpp
Line:INTEGER:224
Function:CHARACTER:SqlThrowExceptionStatement::execute
Type:CHARACTER:ComIbmFilterNode
Name:CHARACTER:MyFlow#FCMComposite_1_5
Label:CHARACTER:MyFlow.InputMessageValidator
Catalog:CHARACTER:Validation Error
Severity:INTEGER:1
Number:INTEGER:7000
Text:CHARACTER:User generated exception
Insert
Type:INTEGER:5
Text:CHARACTER:Please check the Field A. It is a mandotory field |
EXCEPTION 2
Quote: |
ExceptionList
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbDataFlowNode.cpp
Line:INTEGER:957
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmTryCatchNode
Name:CHARACTER:MyFlow#FCMComposite_1_4.ErrorHandler#FCMComposite_1_2
Label:CHARACTER:MyFlow.ErrorHandler.TryCatch
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbComputeNode.cpp
Line:INTEGER:464
Function:CHARACTER:ImbComputeNode::evaluate
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_20.ComIbmMapping#FCMComposite_1_1
Label:CHARACTER:MyFlow.Mapping.ComIbmCompute
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp
Line:INTEGER:602
Function:CHARACTER:SqlStatementGroup::execute
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_20.ComIbmMapping#FCMComposite_1_1
Label:CHARACTER:MyFlow.Mapping.ComIbmCompute
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2488
Text:CHARACTER:Error detected, rethrowing
Insert
Type:INTEGER:5
Text:CHARACTER:.IBM_WBIMB_MyFlow_Mapping.MAIN
Insert
Type:INTEGER:5
Text:CHARACTER:3.1
Insert
Type:INTEGER:5
Text:CHARACTER:MyFlow_Mapping(InputRoot, OutputRoot, InputLocalEnvironment, OutputLocalEnvironment);
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlRoutine.cpp
Line:INTEGER:548
Function:CHARACTER:SqlRoutine::invoke
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_20.ComIbmMapping#FCMComposite_1_1
Label:CHARACTER:MyFlow.Mapping.ComIbmCompute
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2934
Text:CHARACTER:Error occured in procedure
Insert
Type:INTEGER:5
Text:CHARACTER:MyFlow_Mapping
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp
Line:INTEGER:602
Function:CHARACTER:SqlStatementGroup::execute
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_20.ComIbmMapping#FCMComposite_1_1
Label:CHARACTER:MyFlow.Mapping.ComIbmCompute
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2488
Text:CHARACTER:Error detected, rethrowing
Insert
Type:INTEGER:5
Text:CHARACTER:.MyFlow_Mapping
Insert
Type:INTEGER:5
Text:CHARACTER:194.2
Insert
Type:INTEGER:5
Text:CHARACTER:PROPAGATE FINALIZE DEFAULT DELETE DEFAULT;
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/TemplateNodes/ImbRequestTemplateNode.cpp
Line:INTEGER:417
Function:CHARACTER:ImbRequestTemplateNode::processMessageAssemblyToFailure
Type:CHARACTER:ImbRequestTemplateNode
Name:CHARACTER:MyFlow#FCMComposite_1_28.#FCMComposite_1_1.gen/#FCMComposite_1_1
Label:CHARACTER:MyFlow.WebServiceAPI.Request
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
RecoverableException
File:CHARACTER:/build/S610_P/src/WebServices/WSLibrary/ImbSOAPRequestNode.cpp
Line:INTEGER:2148
Function:CHARACTER:ImbSOAPRequestNode::logWebServiceInvocationException
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPv610
Severity:INTEGER:1
Number:INTEGER:3162
Text:CHARACTER:WebService Request Exception
Insert
Type:INTEGER:12
Text:CHARACTER:436f6e74656e742d4c656e6774683a203832360d0a436f6e74657373696e672e636f6d2f417574686f726973650d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a0d0a
Insert
Type:INTEGER:12
Text:CHARACTER:3c3f786d6c2076657273696f6e3d22312e302220656e636f64313a417574686f726973653e3c2f736f6170656e763a426f64793e3c2f736f6170656e763a456e76656c6f70653e
Insert
Type:INTEGER:5
Text:CHARACTER:
Insert
Type:INTEGER:5
Text:CHARACTER:
Insert
Type:INTEGER:5
Text:CHARACTER:POST /webservice.asmx HTTP/1.1
RecoverableException
File:CHARACTER:/build/S610_P/src/WebServices/WSLibrary/ImbWSRequest.cpp
Line:INTEGER:546
Function:CHARACTER:ImbWSRequest::makeWSRequest
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPv610
Severity:INTEGER:1
Number:INTEGER:3152
Text:CHARACTER:A Web Service request has detected a SOCKET error whilst invoking a web service located at host &1, on port &2, on path &3.
Insert
Type:INTEGER:5
Text:CHARACTER:10.1.1.10
Insert
Type:INTEGER:2
Text:CHARACTER:80
Insert
Type:INTEGER:5
Text:CHARACTER:/webservice.asmx
SocketTimeoutException
File:CHARACTER:/build/S610_P/src/CommonServices/ImbBasicSocket.cpp
Line:INTEGER:464
Function:CHARACTER:ImbBasicSocket::connectTimeout
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPv610
Severity:INTEGER:1
Number:INTEGER:3151
Text:CHARACTER:A timeout occurred whilst performing a socket operation
Insert
Type:INTEGER:5
Text:CHARACTER:::connect()
Insert
Type:INTEGER:2
Text:CHARACTER:0
Insert
Type:INTEGER:14
Text:CHARACTER:Success
Insert
Type:INTEGER:2
Text:CHARACTER:121 |
EXCEPTION 3
Quote: |
ExceptionList
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbDataFlowNode.cpp
Line:INTEGER:957
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmTryCatchNode
Name:CHARACTER:MyFlow#FCMComposite_1_4.ErrorHandler#FCMComposite_1_2
Label:CHARACTER:MyFlow.ErrorHandler.TryCatch
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbComputeNode.cpp
Line:INTEGER:464
Function:CHARACTER:ImbComputeNode::evaluate
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_4.ErrorHandler#FCMComposite_1_3
Label:CHARACTER:MyFlow.ErrorHandler.ErrorConstructor
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp
Line:INTEGER:602
Function:CHARACTER:SqlStatementGroup::execute
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_4.ErrorHandler#FCMComposite_1_3
Label:CHARACTER:MyFlow.ErrorHandler.ErrorConstructor
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2488
Text:CHARACTER:Error detected, rethrowing
Insert
Type:INTEGER:5
Text:CHARACTER:.ErrorHandler_ErrorConstructor_Compute.Main
Insert
Type:INTEGER:5
Text:CHARACTER:4.3
Insert
Type:INTEGER:5
Text:CHARACTER:ErrorConstructor();
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlRoutine.cpp
Line:INTEGER:548
Function:CHARACTER:SqlRoutine::invoke
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_4.ErrorHandler#FCMComposite_1_3
Label:CHARACTER:MyFlow.ErrorHandler.ErrorConstructor
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2934
Text:CHARACTER:Error occured in procedure
Insert
Type:INTEGER:5
Text:CHARACTER:ErrorConstructor
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp
Line:INTEGER:602
Function:CHARACTER:SqlStatementGroup::execute
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_4.ErrorHandler#FCMComposite_1_3
Label:CHARACTER:MyFlow.ErrorHandler.ErrorConstructor
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2488
Text:CHARACTER:Error detected, rethrowing
Insert
Type:INTEGER:5
Text:CHARACTER:.ErrorHandler_ErrorConstructor_Compute.ErrorConstructor
Insert
Type:INTEGER:5
Text:CHARACTER:32.4
Insert
Type:INTEGER:5
Text:CHARACTER:SET FlowName = SUBSTRING(Label FROM 1 FOR LastPlace - 1);
RecoverableException
File:CHARACTER:/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlStringFunctions.cpp
Line:INTEGER:2176
Function:CHARACTER:SqlSubstringBaseFnCall::evaluate
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:MyFlow#FCMComposite_1_4.ErrorHandler#FCMComposite_1_3
Label:CHARACTER:MyFlow.ErrorHandler.ErrorConstructor
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2499
Text:CHARACTER:Illegal arguments for SUBSTRING functions
Insert
Type:INTEGER:5
Text:CHARACTER:.ErrorHandler_ErrorConstructor_Compute.ErrorConstructor
Insert
Type:INTEGER:5
Text:CHARACTER:32.17
Insert
Type:INTEGER:5
Text:CHARACTER:SUBSTRING('' FROM 1 FOR -1) |
|
|
Back to top |
|
 |
Luke |
Posted: Tue Aug 25, 2009 4:17 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
Quote: |
Illegal arguments for SUBSTRING functions |
Quote: |
Text:CHARACTER:SUBSTRING('' FROM 1 FOR -1) |
Presumably caused by
Quote: |
SET FlowName=SUBSTRING(Label FROM 1 FOR (LastPlace-1)); |
|
|
Back to top |
|
 |
latitude |
Posted: Tue Aug 25, 2009 4:44 am Post subject: |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
Thanks for the prompt reply Luke. Yes i noticed that but why does it fail only on this exception.It works with all the other once. For some reason it fails on the Lebel variable.
Quote: |
SET Label = start.Label;
SET Place = POSITION('.' IN Label);
SET LastPlace = Place;
WHILE Place <> 0 DO
SET Label=SUBSTRING(Label FROM (Place+1));
SET Place=POSITION('.' IN Label);
SET LastPlace = LastPlace + Place;
END WHILE;
SET Label=start.Label;
SET FlowName=SUBSTRING(Label FROM 1 FOR (LastPlace-1));
SET NodeName=SUBSTRING(Label FROM (LastPlace+1)); |
As per the error
Quote: |
Text:CHARACTER:SUBSTRING('' FROM 1 FOR -1) |
first variable is NULL and the last one is -1. It seams that the variable value is NULL. Any ideas? |
|
Back to top |
|
 |
Luke |
Posted: Tue Aug 25, 2009 4:59 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
Hi,
It's not really possible to do that level of debugging remotely ...
I'd run a trace if I were you, see what happens in the case where it goes wrong.
I'd guess you've navigated somewhere in the tree where one of the fields your code expects isn't there ...
If I'm doing that kind of dynamic moving around a tree, my personal preference is to use LASTMOVE to ensure a reference has been moved correctly e.g. WHILE LASTMOVE(reference) DO ... up to you how you code it of course, but that's what usually works well for me.
Good Luck |
|
Back to top |
|
 |
latitude |
Posted: Tue Aug 25, 2009 5:25 am Post subject: |
|
|
 Apprentice
Joined: 17 Aug 2009 Posts: 36
|
Luke, Can you please explain the use of WHILE LASTMOVE little in detail if possible. |
|
Back to top |
|
 |
Luke |
Posted: Tue Aug 25, 2009 5:41 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
LASTMOVE is a function that returns a boolean reflecting the success or otherwise of the last MOVE you did. Most commonly used with WHILE to do a loop. There's an example in the information center - check out the MOVE statement in there.
Also, seeing as you're looking at error handling, if you haven't seen it already it might be worth checking out this Redbook - 'WebSphere Message Broker V6, Best Practices Guide: Bullet Proofing Message Flows'. Might even be some example code in it I think ... |
|
Back to top |
|
 |
somsayan |
Posted: Wed Aug 26, 2009 1:01 am Post subject: |
|
|
Apprentice
Joined: 06 Apr 2007 Posts: 49
|
As per your code, the Label value turn out to be NULL.
It points to the label value just above the Text "A timeout occurred whilst performing a socket operation". Hence the position function returns a value of -1.
This results in the error for the error handling mechanism. |
|
Back to top |
|
 |
|