Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 7 The Exception Statements : UNTIL Statement

UNTIL Statement
The UNTIL statement specifies an exception or a list of exceptions, each separated by the keyword OR. It allows looping to take place in rules execution. Looping terminates if an exception is detected. An END statement, on a separate line, marks the end of the UNTIL statement.
You can use the UNTIL statement on its own, or in conjunction with a FORALL statement and as part of the UNTIL … DISPLAY statement. For more information about the FORALL statement refer to FORALL Statement and for the UNTIL … DISPLAY statement, refer to UNTIL … DISPLAY Statement.
Usage of UNTIL
An UNTIL statement contains:
1.
2.
3.
4.
Action sequence numbers are not permitted within an UNTIL loop; since an UNTIL loop constitutes a single statement, all the actions within it are executed whenever the UNTIL is executed.
5.
Usage Notes
If a loop terminates because of an exception, control passes to new actions as follows:
If the exception is specified in an UNTIL statement for the loop, the actions executed next are those following the END statement of the loop (control passes to those actions even if there is an ON statement for that exception in the exception handler part of the rule). Upon completion of those actions, the rule is finished executing and control passes to the caller.
If the exception is not handled by the UNTIL statement for the loop but is handled by an ON statement in the exception handler part of the rule, the actions executed next are those listed in the ON statement. Refer to ON Statement for more information.
If the exception is not specified in an UNTIL statement for the loop or in an ON statement in the exception handler part of the rule, either the exception is trapped by an exception handler in a rule higher in the calling hierarchy, or the transaction terminates with an error condition.
Examples
1.
UNTIL NO_MORE_NUMBERS :
   MULTIPLIER = MULTIPLIER + 1;
   CALL CHECKDIGIT(LENGTH($NUMBER));
END;
2.
FORALL SOURCETAB1 UNTIL GETFAIL:
   GET SOURCETAB2 WHERE LINE_NUM = SOURCETAB1.LINE_NUM;
   CALL COMPARELINES(SOURCETAB1.TEXT, SOURCETAB2.TEXT);
END;
About the Examples
Example 1 performs the operations within the UNTIL up to the point the user-defined exception NO_MORE_NUMBERS is issued.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved