Rational Developer for System z

Controls for recording a loop

This topic describes how to use the icons on the host editor toolbar Begin Loop, End Loop, and Exit Loop and the controls in the Exit Flow Loop window to identify the application screens that define a recorded loop.

Table 1 describes how to use each type of loop control, using the information in Figure 1 and Figure 2 as examples. (Figure 1 also appears in General information about recording loops.)

Repeating sequence of one application screen

Figure 1 shows a sequence of application screens in a hypothetical terminal application. Screens U1-U4 display a list of related items, such as a list of machine parts arranged by part number. Screen U1 displays items 1-15, screen U2 displays items 15-29, screen U3 displays items 29-43, and screen U4 displays items 43-50.
Figure 1. A sequence of application screens with a single-screen repeated sequence U1, U2, U3, U4
R,S,T,(U1),(U2),(U3),(U4),V, W, X

The formats, headers, and footers of screens U1-U4 are similar enough so that a single screen description (U) can be used to recognize all four application screens, even though the central area of each screen is different. The screens U1-U4 can then be recorded as a loop, each iteration consisting of a single application screen (U).

With the current number of items in the parts list the loop would run through four iterations, processing application screens U1, U2, U3, and U4. However, the recorded loop is generalized for any number of iterations.

Repeating sequence of multiple application screens

Figure 2 shows a sequence of application screens in another hypothetical terminal application in which there is a repeating sequence of four application screens, repeated three times: K1-N1, K2-N2, and K3-N3.
Figure 2. A sequence of application screens with a multiscreen repeated sequence K1-N1, K2-N2, K3-N3
H,I,J,(K1,L1,M1,N1),(K2,L2,M2,N2),(K3,L3,M3,N3),O,P,Q

At each step of the repeated sequence the related application screens (for example K1, K2, K3 at the first step of the repeated sequence) have similar formats, headers, and footers, even though the central area of each screen (K1, K2, K3) is different. Consequently at each step the related application screens can be recognized by one screen description. That is, K1, K2, and K3 can be recognized by a single screen description (K); likewise L1, L2, and L3 can be recognized by a single screen description (L); and similarly M1, M2, M3 and N1, N2, N3.

The screens K1-N3 can then be recorded as a loop, each iteration consisting of four application screens K, L, M, and N.

With the current example the loop would run through three iterations, processing application screens K1-N1, K2-N2, and K3-N3. However, the recorded loop is generalized for any number of iterations.

Loop controls

Table 1 describes how to use each of the loop controls to record a loop, using as examples the sequences of applications screens in Figure 1 and Figure 2:

Table 1. Using the loop controls
Action before using the loop control: Use the loop control: Navigation before using the loop control -- from the examples:
From Figure 1: From Figure 2:
1. Record the flow in the usual way, creating Extract actions or Insert actions as needed, until you reach the first application screen in the first iteration of the repeated sequence of screens. Click Begin Loop Begin Loop.

R,S,T,(U1) H,I,J,(K1
2.Continue to record the flow in the usual way until you reach the first application screen in the second iteration of the repeated sequence.1 Click End Loop End Loop.

Navigate to R,S,T,(U1),(U2)

Navigate to
H,I,J,(K1,L1,M1,N1),
(K2
3. Navigate to the first application screen that the user encounters after navigating out of the repeated sequence.2 Click Exit Loop Exit Loop.

R,S,T,(U1),(U2),
(U3),(U4),V
H,I,J,(K1,L1,M1,N1),
(K2,L2,M2,N2),(K3,
L3,M3,N3),O
4. None. The Exit Flow Loop window opens automatically when you click Exit Loop Exit Loop

In the Exit Flow Loop window:
  1. Select the check box beside the application screen or screens that are valid exit points from the loop.3
  2. Click OK.
Valid exit-from screens:
  • U (the screen description that is recognized for U1, U2, U3, and U4).
Valid exit-from screens:
  • N (the screen description that is recognized for N1, N2, and N3).
  • Perhaps K, L, or M: the example does not provide enough details to determine.
5. Flow recording is re-enabled when the Exit Flow Loop window closes. Loop recording is complete. Continue recording the flow.4
R,S,T,(U1),(U2),(U3),
(U4),V
H,I,J,(K1,L1,M1,N1),
(K2,L2,M2,N2),(K3,
L3,M3,N3),O
Table notes:
  1. Click Begin Loop, go through one iteration of the loop (which causes you to arrive at the first application screen of the second iteration), and then click End Loop. Note: The host editor suspends flow recording when you click End Loop.
  2. The suspension of flow recording allows you to navigate forward through the application screens of the remaining iterations of the loop without recording any additional application screens or keystrokes.
  3. See Exit-from screens.
  4. Flow recording resumes starting at the Exit Loop application screen.

Exit-from screens

An exit-from screen is an application screen inside a recorded loop from which the user can navigate to the Exit Loop screen in a single step. (The Exit Loop application screen is the first screen that the user encounters after navigating out of the repeated sequence of application screens from which the loop is recorded.) In a recorded loop there can be one exit-from screen or several, depending on the complexity of the structure of the application. Like all application screens managed by a recorded flow, an exit-from screen is recognizable because it matches a recorded screen description.

In the Exit Flow Loop window you select the exit-from screen or screens that are valid for the recorded loop (see In the Exit Flow Loop window).

The reason for having a list of valid exit-from screens is to improve the reliability of loop termination. Depending on the structure of the terminal application it is possible that the Exit Loop application screen occurs inside a recorded loop as well as immediately after the loop. In such a case you might not want the loop to terminate when it encounters the Exit Loop screen inside the recorded loop. Having a list of valid exit-from screens remedies this problem. At runtime a recorded loop is not considered to be terminated unless both the following conditions are met:
  • The currently displayed application screen is the Exit Loop screen; and
  • The application screen just processed is a valid exit-from screen.
The terminal application described in Figure 1 provides an example of an exit-from screen. The recorded loop processes a sequence of application screens U1,U2,U3,U4 that sequentially display the items in a multipage list (see Table 1). The recorded loop is generalized to handle more application screens (U5, U6, and so on) or fewer if the size of the list increases or decreases. Each iteration of the recorded loop processes a single application screen as follows:
  1. Determine whether the currently displayed application screen (U1, U2, U3, or U4 in this example) matches the screen description U.
    • In fact each of the application screens U1, U2, U3, and U4 does match screen description U (see the discussion of Figure 1).
  2. Process the application screen.
The Exit Loop screen in this example is the application screen V, which immediately follows the last application screen in the repeated sequence U1,U2,U3,U4.

The exit-from screen in this example is the screen description U. U matches the definition of an exit-from screen stated in the first sentence of this subtopic: when the user goes from application screen U4 (which matches the screen description U) to application screen V, the user navigates from a screen inside the loop (U) to the Exit Loop screen (V) in one step.

U is also a valid exit-from screen, because you want the loop to terminate when the navigation goes from U to the Exit Loop screen V in one step.

Therefore in the Exit Flow window you would select U as a valid exit-from screen.

The result is that at runtime the recorded loop is terminated if:
  • The current application screen matches the screen description of V (the Exit Loop screen); and
  • The immediately preceding application screen matched the screen description U (a valid exit-from screen).


Feedback