select

The select keyword selects a rule in a rule task.

Purpose

This keyword is used to select a rule in the list of rules that compose the rule task body.

Context

Rule tasks

Syntax

ruletask ruleTaskName 
{
    body = select(?rule) {action1 ... actionq}
};  

Description

You can either specify each rule name explicitly (extension) or have the list of rules computed from the code, which uses the select or dynamicselect keywords (comprehension). The given code must return a Boolean value.

In the classic rule engine, the difference between dynamicselect and select is in the number of times the code is evaluated. In both cases, the code is evaluated the first time the task is called.

In the decision engine for z/OS®, there is no difference between dynamicselect and select. select behaves the same way as dynamicselect where the statement is called each time the task is executed.

Example

flowtask main
{
body {
  selectTask;selectTask;dynamicselectTask;dynamicselectTask;
     }
}

where selectTask and dynamicselectTask are rule tasks with a body respectively defined with a select and a dynamicselect statement. With this ruleflow, the selectTask body is evaluated only once, and the dynamicselectTask body is evaluated twice. If the ruleflow is executed again, after a call to the IlrContext.resetRuleflow method, the selectTask body is evaluated again.