Rational Developer for System z, Version 7.6

Step 3.3: Add logic to the invoked flow

In this step you add nodes and mappings to the flow invoked by the While node.

A While node has associated with it a flow that the While node invokes at runtime when the loop expression in the While node evaluates to Boolean true (see Basic information about While nodes).

When you record a loop during flow recording, the flow recorder (host editor) automatically generates a flow path in the invoked flow. The flow path consists of nodes that manage the application screens that occur during one iteration of the While loop. You can further customize this flow to meet your requirements.

In this step you make the following changes to the invoked flow:

Open the invoked flow and arrange the nodes

In this subtopic you will open the invoked flow and arrange the nodes in it:

  1. Open the flow CheckItemAvailability.seqflow in the flow editor:
    1. In the EST Project Explorer, right-click CatalogSample > Flows > CheckItemAvailability.seqflow.
    2. Click Open With > Flow Editor.

  2. Open the flow invoked by the While node:
    1. On the flow editor canvas double-click the While node while_variable0:
      Icon for the While node
    2. The flow editor opens and displays the invoked flow.

  3. On the flow editor canvas, right-click over any empty part of the canvas and click Zoom Out. (You may need to Zoom Out twice to see all the nodes.)

  4. Arrange the nodes on the canvas of the flow editor so that the appearance is similar to Figure 1. (This rearrangement of the nodes is for convenience only and has no effect on how the flow is performed.)
    Figure 1. Arrange the nodes on the canvas of the flow editor
    Flow invoked by the While node

  5. Save your work (Ctrl-S).

  6. Do not close the flow editor yet. You will use it in the next subtopic.

Add a Switch node and an Assign node to the flow

In this section you will add a Switch node and an Assign node to the invoked flow. These nodes operate as follows:

To add the Switch node:

  1. Delete the connection between the two Invoke screen operations nodes, Dfh0xs2.Exinqc_ExinqcInitialExtract and Dfh0xs2.Exinqc_Exinqc:
    1. Right-click the connection.
    2. Click Delete. The connection is deleted.

  2. Add a new Switch node and drag it to a position between the two Invoke screen operation nodes. The new Switch node has the default name Switch:
    1. Expand the palette drawer on the left side of the flow editor.
    2. Select Switch.
    3. Move the mouse pointer icon over the flow editor canvas to the location where you want to locate the Switch node.
    4. Click the mouse. The Switch node appears on the canvas with the default name Switch.
  3. Connect the Switch node as follows (see Figure 2):
    1. Connect the upper output terminal of Dfh0xs2.Exinqc_ExinqcInitialExtract to the input terminal of the Switch node:
      1. Right click the node Dfh0xs2.Exinqc_ExinqcInitialExtract.
      2. Click Create Connection. The Terminal Selection window opens.
      3. In the Terminal Selection window, in the Select terminal list, click the first terminal (currently named Dfh0xs2.Exinqc_Exinqc).
      4. Click OK. The connection line appears on the flow editor canvas.
      5. Drag the connection line to the node Switch and click the node.
    2. Connect the lower output terminal of the Switch node to the input terminal of the node Dfh0xs2.Exinqc_Exinqc.

To add the Assign node:

  1. Add a new Assign node to the flow editor canvas and drag it to a position above the existing Assign node loopEnd_variable0 (see Figure 2). The new Assign node has the default name Assign.
    1. Expand the palette drawer on the left side of the flow editor.
    2. Select Assign.
    3. Move the mouse pointer icon over the flow editor canvas to the location where you want to locate the Assign node.
    4. Click the mouse. The Assign node appears on the canvas.

  2. Connect the new Assign node as follows:
    1. Connect the upper output terminal of the Switch node to the input terminal of the new Assign node.
    2. Connect the output terminal of the new Assign node to the End node.
Arrange the nodes so that the flow looks something like Figure 2:
Figure 2. CheckItemAvailability.seqflow
View of the flow
Note: The default names of the new Switch node and the new Assign node are Switch and Assign. In this tutorial, there is no reason to rename these nodes. However, you could rename either of these nodes by right-clicking the node and clicking Rename.

Add logic to the new Switch node

In this section you will add an ESQL expression to the new Switch node to compare the item number passed as an input parameter to the flow CheckItemAvailability.seqflow with the item numbers extracted from a page of the Inquire Catalog application screen by the Extract actions.

To add the logic:

  1. In the flow editor, open the invoked flow, if it is not already open (see Open the invoked flow and arrange the nodes).

  2. Edit the ESQL expression for the first (uppermost) output terminal of the Switch node:

    1. Right-click the Switch node.

    2. Click Edit Expression > Expression. The Edit Expression window opens. (The Messages in scope list and the Expression input field are blank.)

    3. In the Edit Expression window:

      1. Add i_CheckItemAvailability.i_CheckItemAvailability to the scope of the expression:
        1. Click Add. The Select Message window opens.
        2. In the Select Message window click CatalogSample > CatalogSample.Interface > Messages > i_CheckItemAvailability.sfmxsd > i_CheckItemAvailability.
        3. Click OK.
        The message i_CheckItemAvailability is added to the scope.
        Note: If the Edit Expression window displays the error message Encountered '<EOF>'... disregard the message. This message refers to the fact that at the moment the expression input field at the bottom of the window is empty.
      2. Add v_CheckItemAvailability.v_CheckItemAvailability to the scope of the expression:
        1. Click Add. The Select Message window opens.
        2. In the Select Message window click CatalogSample > CatalogSample.Interface > Messages > v_CheckItemAvailability.sfmxsd > v_CheckItemAvailability.
        3. Click OK.

        The message v_CheckItemAvailability is added to the scope.

      3. Add an ESQL expression to the expression input field:

        1. Copy the expression shown in Figure 3 into the expression input field at the bottom of the Edit Expression window. You should be able to copy and paste the lines from this tutorial document directly into the input field of the window.

          Figure 3. ESQL expression for the Switch node
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ1-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ2-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ3-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ4-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ5-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ6-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ7-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ8-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ9-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ10-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ11-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ12-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ13-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ14-ITEMREF") OR
          (i_CheckItemAvailability.itemNumber = v_CheckItemAvailability."INQ15-ITEMREF")
          Note:
          • The expression compares the variable i_CheckItemAvailability.itemNumber (which is of type xsd:string) with each of the item numbers (also of type xsd:string), which the Extraction actions read from the fields in the first column of the Inquire Catalog application screen.

          • If a match is found then the ESQL expression resolves to Boolean true, otherwise the ESQL expression resolves to Boolean false.

          • In the runtime environment:
            • If the ESQL expression resolves to true then the flow of control goes out of the Switch node through the first output terminal, which is connected to the Assign node Assign.

            • If the ESQL expression resolves to false then the flow of control goes out of the Switch node through the default (bottommost) output terminal, which is connected to the Assign node loopend_variable0.

      4. Click OK to close the Edit Expression window.

  3. Save your work (Ctrl-S).

Add two mappings to the mapping routine of the new Assign node

Note: For syntax such as v_CheckItemAvailability.available see Note on "<Message>.<element>".

In this section you will add two mappings to the mapping routine of the new Assign node named Assign in the invoked flow. (Recall that mappings allow you to retrieve, manipulate, and store data in a flow – see Mapping concepts.)

As stated earlier this Assign node is connected in the flow so that it is performed only when the requested item number is found.

You will add two mappings to the mapping routine of this Assign node that perform the following tasks:

To create these two mappings:

  1. Open the mapping routine of the Assign node named Assign in the mapping editor:

    1. Right-click the Assign node named Assign.

    2. Click Open Mapping Routine.

      The mapping editor opens the mapping file for the flow, automatically creates an empty mapping routine for the Assign node, and displays the mapping routine in the mapping routine area of the mapping editor.

  2. Add the message v_CheckItemAvailability to the mapping routine as a target message. (Actually, a reference to this message is added to the mapping routine.)

    1. On the mapping routine toolbar, click the Add a target message Add a target message icon. The Select Message window opens.

    2. In the Select Message window:
      1. Click the message CatalogSample > CatalogSample.Interface > Messages > v_CheckItemAvailability.sfmxsd > v_CheckItemAvailability.

      2. Click OK.

      The target message is added to the right side of the mapping routine area.

      Note about storing a reference to a message in a mapping routine: When you add a source message or a target message to a mapping routine, the mapping editor actually stores into the mapping routine a reference to the message rather the actual message itself.

      The actual message still resides in its place within the message file that it belongs to. When you delete a source message or a target message from a mapping routine, the mapping editor deletes the reference. The actual message in the message file not deleted.

  3. Create a mapping that stores the string YES into the target element v_CheckItemAvailability.available:

    1. On the target side of the mapping routine area, right-click v_CheckItemAvailability.available:
      1. If necessary, scroll the editor area to the right until you can see the target message v_CheckItemAvailability.
      2. Right-click the last message element in the message -- the message element available.

    2. Click Create Transform:

      The mapping editor displays a new Assign transform in the center area of the mapping routine beside the message element available with a connection running from the Assign transform to the message element available.
      Note: The new Assign transform is labeled Assign because this type of transform assigns a literal value to a target message element. The name has nothing to do with the fact that this mapping routine also belongs to an Assign node named Assign.

    3. Open the Properties view of the mapping editor if it is not already open (see Opening or reopening a view).

    4. In the editor view of the mapping editor, click the Assign transform. The mapping editor displays the properties of the selected transform in the Properties view.

    5. In the Properties view:
      1. Click the General tab.
      2. In the Value field type the string YES.
        Note on typing literal text into the Value field: Do not type single quotation marks around a string in the Value field:
        • The Value field on the General tab of the Assign transform expects normal text (see Transforms that create one-sided mappings).
        • In contrast, if you were typing an ESQL expression and you wanted to use a text string such as YES then you would enclose the text in single quotes: 'YES'.

      The new mapping is now configured to store the string YES into v_CheckItemAvailability.available.

  4. Create a mapping that stores the string FALSE into the message element v_CheckItemAvailability.variable0:

    1. On the target side of the mapping routine area, right-click v_CheckItemAvailability.variable0:

    2. Click Create Transform:

      The mapping editor displays a new Assign transform in the center area of the mapping routine beside the message element variable0 with a connection running from the Assign transform to the message element variable0.

    3. Open the Properties view of the mapping editor if it is not already open (see Opening or reopening a view).

    4. In the editor view of the mapping editor, click the new Assign transform. The mapping editor displays the properties of the selected transform in the Properties view.

    5. In the Properties view:
      1. Click the General tab.
      2. In the Value field type the string FALSE. Do not type single quotation marks around the string FALSE (see Note on typing literal text into the Value field).

      The new mapping is now configured to store the string FALSE into v_CheckItemAvailability.variable0.

  5. Close the mapping editor.

Close the invoked flow

The flow editor displays the nodes of the invoked flow. To close the invoked flow:

  1. Open the Outline view of the flow editor if it is not already open (see Opening or reopening a view). The Outline view displays a tree representation of the flow CheckItemAvailability.seqflow that contains a tree-nodes for each of the nodes in the flow, including:
    • A tree-node for each node in the flow CheckItemAvailability.seqflow.
    • Under the tree-node for the While node, a tree-node for each node in the invoked flow.

  2. In the Outline view click any node not contained in the invoked flow (see Editing the flow invoked by a While node). The flow editor performs the following actions:
    1. It closes the invoked flow.
    2. It displays the contents of the flow CheckItemAvailability.seqflow.

  3. Close the flow editor.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)