访问 ExceptionList 树

ExceptionList 树具有自己的相关名 ExceptionList,您必须在引用或设置此树内容的所有 ESQL 语句中使用此相关名。

此树在解析输入消息时使用逻辑树创建。它开始时是空的,且仅在消息流处理期间发生异常时填充。可能发生多个异常;如果发生这种情况,则 ExceptionList 树包含每个异常的子树。

您可以访问 Compute、Database 和 Filter 节点中的 ExceptionList 树,而且可以在 Compute 节点中更新它。必须使用相应的相关名;对 Database 或 Filter 节点使用 Exception List,对 Compute 节点使用 InputExceptionList。

您可能要在错误处理过程中在节点中访问此树。例如,您可能要基于异常类型将消息路由到不同路径,如使用 ESQL THROW 语句明确生成的异常,或代理生成的异常。

以下 ESQL 显示了如何访问 ExceptionList 并处理它包含的每个子代:

-- Declare a reference for the ExceptionList
-- (in a Compute node use InputExceptionList)
DECLARE start REFERENCE TO ExceptionList.*[1];

-- Loop through the exception list children
WHILE start.Number IS NOT NULL DO
   -- more ESQL

   -- Move start to the last child of the field to which it currently points
   MOVE start LASTCHILD;
END WHILE;

下面第二个示例显示了 ESQL 的摘要,该 ESQL 编码用于 Compute 节点从异常列表循环至最后一个(嵌套的)异常描述,并抽取错误号。此错误与问题的最初原因有关,通常提供最准确的信息。消息流执行的后续操作可以由用此方法检索的错误号确定。

CREATE PROCEDURE getLastExceptionDetail(IN InputTree reference,OUT messageNumber integer,
OUT messageText char)
    /****************************************************************************
* A procedure that will get the details of the last exception from a message
* IN InputTree: The incoming exception list
* IN messageNumber: The last message numberr.
* IN messageText: The last message text.
	 *****************************************************************************/
   BEGIN
   -- Create a reference to the first child of the exception list
   declare ptrException reference to InputTree.*[1];
   -- keep looping while the moves to the child of exception list work
WHILE lastmove(ptrException) DO
-- store the current values for the error number and text
IF ptrException.Number is not null THEN
        SET messageNumber = ptrException.Number;
        SET messageText = ptrException.Text;
  END IF;
  -- now move to the last child which should be the next exceptionlist
move ptrException lastchild;
END WHILE;
	END;

有关使用 ExceptionList 的更多信息,请参阅错误处理程序样本中的子流,该样本包含查询 ExceptionList 结构并根据它的内容采取特定操作的 ESQL。

相关概念
消息流概述
ExceptionList 树结构
ESQL 概述
消息建模
相关任务
处理消息流中的错误
设计消息流
定义消息流内容
管理 ESQL 文件
相关参考
Compute 节点
异常列表结构
ESQL 引用
DECLARE 语句
EVAL 语句
WHILE 语句
声明 | 商标 | 下载 | 书库 | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后一次更新时间:2006/08/14
ac16830_