After performing all the action statements requested by an IF-THEN-ELSE group, the
flow control statements can be used to terminate or continue rule processing.
Once an IF-THEN-ELSE has successfully completed, the rules language can continue scanning at the next IF-THEN-ELSE, the next rule definition, a specific rule definition, or simply exit the rules language. By default, rules processing terminates after a successful IF-THEN-ELSE -- no other IF-THEN-ELSE groups or DEFRULES will be scanned.
The CONTINUE parameter on the DEFPROD statement establishes the defaults for flow control processing. The CONTINUE parameters on the DEFRULE and DEFPROC statements can override the established defaults for the rule or procedure definition.
Lastly, the CONTINUE statement can be used in an IF-THEN-ELSE to control flow processing.
By default, the product uses CONTINUE(RETURN,RETURN) for rule processing. The two operands establish the defaults for the THEN and ELSE sections of an IF-THEN-ELSE, respectively. If an IF group evaluates as false, and no ELSE section is coded, flow control always performs a NEXTIF request, and processing continues at the next IF-THEN-ELSE.
The following structure displays a typical IF-THEN-ELSE definition:
IF if_expression_1 if_expression_2
...
if_expression_n
THEN action_statements
flow_control_statements
ELSE action_statements
flow_control_statements
One or more of the following flow control statements can be used within a THEN or ELSE section.
CONTINUE Continue at NEXTIF, NEXTRULE, or specified DEFRULE
EXIT Exit the rules language EXITDO Exit the DO-END statement EXITPROC Exit the procedure
RETURN Perform EXIT, EXITDO or EXITPROC where appropriate
CONTINUE
Function: After the action statements within a THEN or ELSE section are
processed, rules processing has several options for continued rules scanning:
- rule processing continues on the NEXTIF
- rule processing continues on the NEXTRULE
- rule processing continues at a specified rulename
The CONTINUE SCANNING parameter can be used to force continued processing of the rules language.
When CONTINUE SCANNING is specified without a destination, the product will continue with the next IF-THEN-ELSE. If CONTINUE SCANNING AT NEXTIF is specified, processing will continue with the next IF-THEN-ELSE.
If CONTINUE SCANNING AT NEXTRULE is specified, the product will continue with the first IF-THEN-ELSE group of the following DEFRULE statement.
If CONTINUE SCANNING AT rulename is specified, processing will continue with the first IF-THEN-ELSE group of the specified DEFRULE statement. Note: in order to prevent looping within the rules language, do not allow scanning to continue at a previous DEFRULE statement.
Default: The default for this parameter is established by the CONTINUE
parameters on the DEFPROD, DEFRULE and DEFPROC statements.
Format: CONTINUE SCANNING
CONTINUE SCANNING AT NEXTIF
CONTINUE SCANNING AT NEXTRULE
CONTINUE SCANNING AT rulename
Function: By default, rules processing usually terminates after executing
the action statements -- no other IF-THEN-ELSE groups or DEFRULES will be scanned. If the CONTINUE parameter on the DEFPROD or DEFRULE statements have modified the default, the EXIT flow control statement can be used in action processing to force termination of rule processing.
If EXIT is used with a procedure
definition, EXIT also terminates rule processing. Rule scanning will not return to the caller of the procedure.
The EXIT statement does not have to be the last statement found in a THEN or ELSE section. The product processes the termination request after completing all the action statements within the section.
Default: The default for this parameter is established by the CONTINUE
parameters on the DEFPROD, DEFRULE and DEFPROC statements.
Format: EXIT
EXITDO
Function: Once an IF-THEN-ELSE within a DO-END statement has
successfully completed, the rules language can continue scanning at the next IF-THEN-ELSE group, exit the DO-END, or simply exit the rules language. By default, rules processing terminates the DO-END statement.
EXITDO is only required when the CONTINUE parameter on the DEFPROD statement, the current rule definition or the current procedure has modified the default.
The EXITDO statement does not have to be the last statement found in a THEN or ELSE section. The product processes the termination request after completing all the action statements within the section.
Default: The default for this parameter is established by the CONTINUE
parameters on the DEFPROD, DEFRULE and DEFPROC statements.
Format: EXITDO
Function: Once an IF-THEN-ELSE within a procedure has successfully
completed, the rules language can continue scanning at the next IF-THEN-ELSE group, exit the procedure, or simply exit the rules language. By default, rules processing terminates the procedure statement.
EXITPROC is only required when the CONTINUE parameter on the
DEFPROD statement or DEFPROC statement definition has modified the default.
The EXITPROC statement does not have to be the last statement found in a THEN or ELSE section. The product processes the termination request after completing all the action statements within the section.
Default: The default for this parameter is established by the CONTINUE
parameters on the DEFPROD and DEFPROC statements.
Format: EXITPROC
RETURN
Function: Once an IF-THEN-ELSE within a rule definition, procedure or
DO-END statement has successfully completed, the rules language can continue scanning at the next IF-THEN-ELSE group, exit the procedure or DO-END, or simply exit the rules language.
If RETURN is specified in a DEFRULE statement, the product terminates rule processing. When used in a procedure or DO-END statement, the product returns to the calling statement.
RETURN is only required when the CONTINUE parameter on the DEFPROD, DEFRULE or DEFPROC
statement definition has modified the default.
The RETURN statement does not have to be the last statement found in a THEN or ELSE section. The product processes the termination request after completing all the action statements within the section.
Default: The default for this parameter is established by the CONTINUE
parameters on the DEFPROD, DEFRULE and DEFPROC statements.
Format: RETURN