The completed service flow simulates an
ordering system that checks for the availability of a requested item
and then places an order for the item if it is available.
This topic and its subtopics are provided for completeness. You
do not have to read this topic to perform the steps in the tutorial.
However, you might want to refer to this topic from time to time,
to review how the step you are working on fits in with the whole.
Top-level flow
Figure 1 shows the
top-level flow:
Figure 1. Contents of the top-level flow
When the top-level flow is invoked:
- The node variableAssignInput gets the two
input parameters provided by the caller: an item number and an item
quantity.
- The next node CheckItemAvailability invokes
a recorded flow to determine whether the item having the specified
item number is available.
- A Switch node tests the return code provided by the recorded flow:
- If the item is available then the upper path of control is taken:
- The node PlaceOrder invokes a nonterminal
application to place the order.
- The node variableAssignOuput sets up a
return value and a return message from the flow indicating that the
request was performed successfully.
- If the item is not available then the lower path of control is
taken:
- The node Assign2 sets up a return value
and a return message from the flow indicating that the request failed.
Recorded flow
The recorded
flow launches a terminal application and scans the screens of a catalog
looking for the requested item number.
Figure 2 shows the recorded
flow:
Figure 2. Contents
of the recorded flow
When the recorded flow is invoked:
- The Assign node variableAssignInput gets
the input parameter, which is an item number.
- The node Dfh0xs1Exmenu_Exmenu simulates
user input to request the terminal application to display a catalog
of items.
- The init node init_variable0 initializes
the loop variable for the While node.
- The While node while_variable0 repetitively
invokes its associated flow, which scans one screen of the catalog
for the specified item number. The loop terminates if the specified
item number is found or when all the screens of the catalog have been
scanned.
- A Switch node tests the return code from the invoked flow.
- If the item is found then the upper path of control is taken:
- A return code for the flow is set indicating that the item was
found.
- The node dfh0xs2.Exinqc_EndPage simulates
user input to navigate beyond the last screen of the catalog.
- If the item is not found then the lower path of control is taken:
- A return code for the flow is set indicating that the item was
not found.
Flow invoked by the While node
The flow invoked by the While node searches one screen
of the catalog for the specified item number and then returns to the
While node. Figure 3 shows
the invoked flow.Figure 3. Contents of the flow invoked by the While
node
When the invoked flow is invoked by the
While node:
- Mappings in the output terminal of the node Dfh0xs2.Exinqc_ExinqcInitialExtract copy
the item numbers from the currently displayed screen of the catalog
and store the item numbers into variables.
- The Switch node contains an ESQL expression testing whether any
of the item numbers just read are the requested item number:
- If the item number is found then the upper path of control is
taken:
- The node Assign sets a global variable
indicating that the requested item number is found. The node then
sets the loop variable so that the While node terminates the loop
at the next opportunity.
- If the item is not found then the lower path of control is taken:
- Mappings in the input terminal of the node Dfh0xs2.Exinqc_Exinqc generate user input to navigate forward to the
next screen of the catalog:
- If the new screen is the Exit Loop screen
-- the first screen that occurs after the last screen of the catalog
-- then the upper path of control is taken:
- The node loopEnd_variable0 sets
the loop control variable to terminate the While loop.
- Otherwise the lower path of control is taken. The loop variable
is not modified, so the While node continues to invoke this flow.