Rational Developer for System z

Recorded loop: Non-iterative case

This topic describes how a recorded loop is implemented in a recorded flow in the non-iterative case, that is, when you do not select the check box Extract data every iteration of the loop in the Select Variable window.
The implementation of a recorded loop includes:
Note: You can customize a recorded loop by including additional nodes and mapping routines both in the recorded flow and in the invoked flow (for examples see the tutorial topics Step 3.3: Add logic to the invoked flow, Step 3.4: Add logic to CheckItemAvailability.seqflow, Step 4.1: Invoke the recorded flow from the top-level flow, and Step 4.2: Add a Switch node to the top-level flow).

The loop variable

The While node checks the loop variable to determine whether to perform another iteration of the loop (by invoking the flow associated with the While node) or to stop looping (see Basic information about While nodes).

By default the loop variable is a String variable with a maximum length of 5 (to contain the string TRUE or the string FALSE). The loop expression in the While node tests to see whether the loop variable contains the string TRUE, for example:
v_Dfh0xs1_Exmenu_Exmenu.strLoopVar = 'TRUE'
At runtime if this expression resolves to Boolean true then the While node invokes its associated flow. Otherwise the While node stops looping and terminates (see Basic information about While nodes).

The loop variable is initialized in the init node (see Init node, While node, and parse node).

Note:
You can edit the expression in the While node to use a variable of a different type, or additional variables, or a more complex expression, depending on your requirements. If you do this customization, you might also need to modify:
  • The mapping that initializes the value of the loop variable or variables so that the expression in the While node initially resolves to Boolean true, so that the loop runs the first time.
  • The mapping that later sets the value of the loop variable or variables so that the expression in the While node resolves to Boolean false, so that the loop terminates.

Init node, While node, and parse node

In the recorded flow the following nodes are created to implement the While loop function: an init node, a While node, one or more parse nodes, and connections to existing Invoke screen operation nodes that manage application screens. The names of the first three types of nodes are formed by adding the appropriate prefix to the name of the loop variable, for example init_LoopVar, while_LoopVar, and parse_LoopVar.

Figure 1 shows an example of these nodes:
Figure 1. Example of init node, While node, and parse node
Example showing the init node, the While node, and the parse node

The invoked flow

The flow invoked by the While node performs one iteration of the loop and returns. The While node invokes this flow repeatedly so long as the expression in the While node evaluates to Boolean true (see Basic information about While nodes).

In a recorded loop the invoked flow contains Invoke screen operation nodes that manage the application screens that you visited between selecting Begin Loop and End Loop: one iteration of the loop (see Loop controls).

Figure 2 shows an example of an invoked flow. This invoked flow processes a single application screen that displays one screen of a multipage list (see Recording a multipage list as a loop):
Figure 2. Example of an invoked flow from a recorded loop
Contents of the invoked flow
Here is an overview of the logic of this flow:
  • The flow of control enters through the Receive node (Start) and goes to the next node.
  • The next node is a parse node (Dfh0xs2.Exinqc_ExinqcInitialExtract). The flow of control goes through the first output terminal of this node if the recognized screen is the screen that displays one page of the multipage list. The mapping for this output terminal contains mappings for Extract actions belonging to the next node.

  • The next node is an Invoke screen operation node (Dfh0xs2.Exinqc_Exinqc).
    • The mapping for the input terminal contains an Input action that generates an AID key (F8) that navigates forward to the next application screen.
    • The first output terminal gets the flow of control if the new recognized screen is the Exit Loop screen. The connection from this terminal goes to the Assign node (loopEnd_strLoopVar) which sets a variable indicating that the While loop is terminated.
    • The second output terminal gets the flow of control if the recognized screen is the next screen of the multipage list. The connection from this output terminal simply goes to Reply node.
  • The Reply node (End) returns control to the While node that invoked the flow.


Feedback