Rational Developer for System z

Basic information about While nodes

This topic provides basic information about While nodes.

When you create a While node in the flow editor, the flow editor creates two artifacts: (a) the While node itself; and (b) an initially empty flow (containing only a Receive node and a Reply node) for the While node to invoke.

The While node is created in the flow you that are currently editing. For this While node to function correctly you must create an ESQL expression in the While node that resolves to a Boolean true or false value. This ESQL expression serves as the loop condition for the While loop.

The invoked flow is a normal invoked flow except for the fact that it is invoked from within the While node rather than from an Invoke flow node. In the invoked flow you create a sequence of nodes that perform the operations that you want to be repeated when the While loop runs. The invoked flow serves as the interior of the While loop.

When the While node is processed at runtime it performs the following cycle:
  1. It evaluates the ESQL expression stored in the While node.
  2. It takes some action based on the resulting value of the ESQL expression:
    • If the expression resolved to Boolean true in Step 1 then the While node invokes the invoked flow, waits for it to return from invocation, and then begins the cycle again starting with Step 1.
    • If the expression resolved to false in Step 1 then the While node does not invoke the invoked flow and instead terminates, with the flow of control passing out from the output terminal of the While node.
For the While loop to perform properly you might also need to set up the following items:

You can use While nodes and their invoked flows both in nonterminal applications and in terminal applications.

Also, in terminal applications you can record a repeating sequence of application screens as a loop. When you record a loop the flow recorder (host editor) creates a While node and its invoked flow, populates the invoked flow with nodes to handle the application screens that you visit, sets up a loop variable and a loop expression, and performs other tasks (see Recording loops).


Feedback