Control flow objects define the actions to take and the functions to perform after a message frame object matches data. Control flow objects can be contained within a control flow object or separate within an AIM. The object generates a single function that executes all of the commands (the functions or methods) in the control flow. The commands in a control flow object act on the data itself or on other objects in the program that you want to manipulate based upon the data content. You must always pass the argument “blob *pb” to a control flow object in the Flow Arg. SLE of the control flow dialog box because the control flow object always receives the data in a blob.
Control flow object also provides a graphical representation of the commands, showing the order in which they are executed. A control flow object can be called by three objects. It can be called by:
A protocol object after the protocol object receives a data packet from the communication object.
A message from object after that message frame matches on data.
Another control flow object
Defining a control flow object
Select Control Flow from the list of objects in the main MSG-IDE window and click Add. The Control Flow window appears.
Click in the Name field and type the name you want to assign to this control flow.
This name, prepended by an underscore, becomes the reference name of the function generated by the control flow. For example, if you name the control flow cf1, you call it with the reference name _cf1. Use this reference name to activate the control flow object commands if you do not enter a name in the Run box.
After you build the control flow, this reference name appears in the Objects List in the Browse dialog box when the Function class is selected.
(Optional) To call the control flow object with an alternate name, type the name in the Run box.
For example, if you name the control flow cf1, but want to call it with the name myCF1, enter myCFI in this field.
When you use this field, this is the name that appears in the Objects list in the Browse dialog box when you select the Function class, and this is the name that appears in any drop-down lists from which you select function objects.
The Flow Argument Declaration defines the arguments that must be passed to the control flow object when it is called. These arguments depend on what type of object is calling the control flow. The following table describes the argument to use for each of the objects that can call a control flow object.
Object calling the control flow |
Flow Arg. Declaration |
---|---|
Protocol: for an Open control flow |
Leave this entry blank. |
Protocol: for a Close control flow |
Leave this entry blank. |
Protocol: for a Preview control flow |
blob *pb |
Message frame object |
blob *pb |
another control flow object |
user defined |
Impact (to service a DFC command) |
blob *pb |
To put arguments in the Flow Arg. declaration field, select the appropriate argument from the Arguments menu bar option:
Argument |
Description |
---|---|
Custom |
Select this only if the control flow is executed by another control flow and is passed an argument other than blob *pb. Enter the required argument declarations in the Flow Arg. field. |
Callback |
Not applicable to a message AIM. |
Validation |
Not applicable to a message AIM. |
blob *pb |
Places blob *pb in the Flow Arg. declaration field. Select for all control flows, except Open and Close and for the exception stated under the Custom description above |
Do one of the following:
To make the control flow available only to objects in the same module, click the Exclusive to Domain check box.
To make the control flow available to all objects in the entire project, deselect the Exclusive to Domain check box.
Use the following command specification fields to identify or define the functions for this control flow to execute and the objects for it to manipulate:
Field |
Description |
---|---|
Description |
For each command, an icon appears in the Commands list of the Control Flow. The Description field value appears next to this icon. |
Statement |
Click Statement when your function or object performs some action that does not require comparison, such as a function that builds a list or that gathers data from some external source. When you use a Statement, the control flow does not check the return value from the function or object method performed. It continues processing its remaining commands regardless of the return value for the function or method. Use Test if the control flow should stop processing or perform a different set of actions if the function or method returns a value other than a 1. |
Test |
Click Test when your function contains an “if” statement or when the control flow should perform one set of commands when the function or object method returns a value of 1 or another set of commands if it does not. For example, if the function “check that GL system is up” returns a value of 1, the control flow executes the “send data to GL” and “send ACK to client” statements. Otherwise, the control flow executes the “notify administrator that GL system is down” and “send NAK to client” statements. |
Test/Loop |
Click Test/Loop when your function contains a “while” statement. If the statement returns a value of 1, the control flow executes the commands in the path indicated by the 1 in the icon. |
Stop |
Click Stop to generate a simple return statement. Place it at any point at which your control flow should stop processing. |
Select Function to build a command that uses a function or another control flow. If the function or control flow exists in the project, select it from the drop-down list.
If you entered a value in the Run field, that value is what appears in this list, not the control flow object reference name
To build a new function from within the control flow dialog box, choose from the following:
Enter its name in the Function field, enter the arguments that should be used to call the function in the Command Arguments field, and then type the Function logic in the viewing area at the bottom of the Control Flow dialog box.
Click Detail. From the Edit Function dialog box, define the function and then select File | Update to build the function and return to the Control Flow dialog box.
If the Function was selected, declare the datatype of each argument in the Command Arguments field in the Command Argument Declaration field.
For example, if the Command Arguments data object is named “my_int” (integer datatype), then this field has an argument declaration of “int my_int”.
Separate each argument with a comma. For example: string name,string
address,string city,int zip
To execute a method on a particular object, click Object and select the object name in the Object field. Select the associated object method from the Method list, and enter the method's arguments in the Command Arguments field.
If the Object was selected, list the data objects that
contain the information to be sent to the function or method in
the Command Arguments field. In effect, you should enter the arguments
as you would when making a call to a function or method. Separate
each argument with a comma. For example: name,address,city,zip
The control flow logic displays in Commands pane in flow chart format as you build the control flow object. The control flow executes the functions and methods in the order in which they are listed in this box.
To modify or move commands in the Commands pane, do the following:
Click the buttons below the Commands box to modify the display.
These buttons let you add, update, or remove items from the display and move existing items to different locations in the control flow. This updates only the command display in the control flow, not the associated function.
Click Update if you modify a command in the Commands box. If you do not, a warning message appears.
Click the arrow buttons to move a command from one location to another in the control flow. Highlight a command in the Commands box and click the arrow pointing in the appropriate direction. The object moves one position with each click
Select File | Close to close the control flow without updating.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |