Rational Developer for System z

Step 4.1: Invoke the recorded flow from the top-level flow

In this step you will: (a) modify the Invoke node Step0 in the top-level flow CatalogOrder.seqflow so that Step0 invokes the recorded flow CheckItemAvailability.seqflow; (b) copy data from the input message of the top-level flow into working variables; and (c) add a new Assign node to the top-level flow that retrieves the result returned by the recorded flow CheckItemAvailability.seqflow.

Modify the Invoke node Step0 to invoke the recorded flow

In this subtopic you will convert the plain Invoke node Step0 in the top-level flow to an Invoke flow node that invokes the recorded flow CheckItemAvailability.seqflow.

Recall that you created the Invoke nodes Step0 and Step1 as place holders (see Position the nodes, add Assign nodes and Invoke nodes, and connect the nodes).

A plain Invoke node such as Step0 can be made functional by associating with it an operation or a flow. In this subtopic you will associate the flow CheckItemAvailability.seqflow with Step0 so that Step0 is converted to an Invoke flow node that invokes the recorded flow CheckItemAvailability.seqflow.

To convert Step0 to an Invoke flow node that invokes the recorded flow:

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

  2. In the workbench's main menu click View > Zoom Out.

  3. Right-click Step0.

  4. Click Select Subflow. The Select Flow window opens.

  5. In the Select Flow window:

    1. Click CatalogSample > Flows > CheckItemAvailability.seqflow.

    2. Click OK.

    Step0 is converted to an Invoke flow node and is given the name of the flow that it invokes, CheckItemAvailability.

  6. Save your work (Ctrl-S).

  7. Do not close the flow editor yet. You will need it for the next subtopic.

Copy data from the input message i_CatalogOrder

Note: For syntax such as i_CatalogOrder.itemNumber see Note on "<Message>.<element>".

In this subtopic you will add three mappings to the mapping routine for the Assign node VariableAssignInput. All three mappings copy data from input parameters stored in the input message i_CatalogOrder of the top-level flow (see Table 1). The values are set by the application that calls the service flow.

Table 1. Mappings from iCatalogOrder
Source variable of the mapping: Target variable of the mapping: Type of mapping:
Name: Data type: Name: Data type:
i_CatalogOrder.itemNumber xsd:short i_CheckItemAvailability.itemNumber xsd:string Cast
i_CatalogOrder.itemNumber xsd:short v_CatalogOrder.itemNumber xsd:short Move
i_CatalogOrder.itemQuantity xsd:short v_CatalogOrder.itemQuantity xsd:short Move

The first mapping copies the first input parameter passed to CatalogOrder.seqflow -- the item number that the calling program is searching for -- into the input message for the invoked flow CheckItemAvailability.seqflow.

To create the first mapping:

  1. Open CatalogOrder.seqflow in the flow editor, if it is not already open.

  2. Open the mapping routine of the Assign node variableAssignInput in the mapping editor.

    1. Right-click the Assign node variableAssignInput.

    2. Click Open Mapping Routine. The mapping editor opens the mapping file for the flow and displays the empty mapping routine for the Assign node.

  3. Add i_CatalogOrder to the mapping routine as a source message:

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

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

      2. Click OK.

      The source message is added to the left side of the mapping routine area.

  4. Add i_CheckItemAvailability to the mapping routine as a target message:

    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 CatalogSample > Catalog.Interface > Messages > i_CheckItemAvailability.sfmxsd > i_CheckItemAvailability.

      2. Click OK.

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

  5. Create a mapping that copies the contents of i_CatalogOrder.itemNumber to i_CheckItemAvailability.itemNumber:

    1. Drag i_CatalogOrder.itemNumber on the left side of the mapping routine area to i_CheckItemAvailability.itemNumber on the right side.

    The mapping editor displays a new Cast transform in the center column of the mapping routine area between the two message elements with a connection running from the source element to the transform and another connection running from the transform to the target element.
    Note: The Cast transform reads the integer value from the source variable, casts the integer value to a string value, and stores the string value into the target field.
  6. Save your work (Ctrl-S).

The second and third mappings to be added to this mapping routine copy the two input parameters -- itemNumber and itemQuantity -- from the i_CatalogOrder input message to the v_CatalogOrder variable message. To create the second and third mappings:

  1. Add the source message to the mapping routine.
    Note: No action is required here because the message i_CatalogOrder has already been added to the mapping routine as a source message.
  2. Add v_CatalogOrder to the mapping routine as a target message:

    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 CatalogSample > CatalogSample.Interface > Messages > v_CatalogOrder.sfmxsd > v_CatalogOrder.

      2. Click OK.

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

  3. Create a mapping that copies the contents of i_CatalogOrder.itemNumber to v_CatalogOrder.itemNumber:

    1. Drag i_CatalogOrder.itemNumber on the left side of the mapping routine to v_CatalogOrder.itemNumber on the right side.

    The mapping editor displays a new Move transform in the center of the mapping routine area between the two message elements with a connection to each message element.

  4. Create a mapping that copies the contents of i_CatalogOrder.itemQuantity to v_CatalogOrder.itemQuantity:

    1. Drag i_CatalogOrder.itemQuantity on the left side of the mapping routine to v_CatalogOrder.itemQuantity on the right side.

    The mapping editor displays a new Move transform in the center of the mapping routine area between the two message elements with a connection to each message element.

  5. Close the mapping editor.

Add an Assign node to the top-level flow

In this subtopic you will add a new Assign node named Assign to the flow v_CatalogOrder.seqflow immediately after the Invoke flow node CheckItemAvailability and you will add a mapping to the mapping routine of this new Assign node.

The purpose of the mapping is to copy the contents of o_CheckItemAvailability.available into v_CatalogOrder.available.
Note: The invoked flow CheckItemAvailability.seqflow returns its output value in o_CheckItemAvailability.available. This string variable contains the string YES if the requested item number was found or an empty string if the requested item number was not found (see Use of v_CheckItemAvailability.available in the flow CheckItemAvailability.seqflow).

To create the Assign node and the mapping:

  1. Open the flow CatalogOrder.seqflow in the flow editor if it is not already open.

  2. In the workbench's main menu, click View > Zoom Out.

  3. Arrange the nodes to leave space for the remaining work that needs to be done in Part 4:

    1. In the workbench's main menu, click View > Manhattan Layout.

    2. Arrange the nodes in a layout like Figure 1.

      Figure 1. Arrange the nodes
      CatalogOrder.seqflow with Manhattan layout

  4. Add a new Assign node named Assign to the flow immediately after the Invoke flow node CheckItemAvailability:

    1. Delete the connection between the node CheckItemAvailability and the node Step1.

    2. Add a new Assign node to the flow editor canvas and position it immediately to the right of the node CheckItemAvailability. The name of the new Assign node is the default name Assign.

    3. Create a connection from the output terminal of CheckItemAvailability to the input terminal of Assign (see Figure 2).

    Figure 2. Create a connection
    Nodes CheckItemAvailability and Assign

  5. Create a mapping in the mapping routine of the new Assign node that copies the result value returned by the invoked flow in the variable o_CheckItemAvailability.available into the variable v_CatalogOrder.available used by the top-level flow:
    Table 2. Mapping from oCheckItemAvailability
    Source variable of the mapping: Target variable of the mapping: Type of mapping:
    Name: Data type: Name: Data type:
    o_CheckItemAvailability.available xsd:string v_CatalogOrder.available xsd:string Move
    1. Open the mapping routine for the new Assign node:
      1. Right-click the Assign node.
      2. Click Open Mapping Routine. The mapping editor opens the mapping file for the flow and displays the mapping routine for the new Assign node.

    2. Add o_CheckItemAvailability to the mapping routine as a source message:
      1. On the mapping routine toolbar, click the Add a source message Add a source message icon. The Select Message window opens.

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

        2. Click OK.

        The source message is added to the left side of the mapping routine area.

    3. Add v_CatalogOrder to the mapping routine as a target message:
      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 CatalogSample > CatalogSample.Interface > Messages > v_CatalogOrder.sfmxsd > v_CatalogOrder.
        2. Click OK.

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

    4. Create a mapping that copies the contents of o_CheckItemAvailability.available to v_CatalogOrder.available:
      1. Drag o_CheckItemAvailability.available on the left side of the mapping routine area to v_CatalogOrder.available on the right side of the mapping routine area.

      The mapping editor displays a new Move transform in the center of the mapping routine area between the two message elements with a connection to each message element.

    5. Close the mapping editor.

  6. Close the flow editor.


Feedback