Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 2 Composition of a Rule : Coding Actions

Coding Actions
Action Statements
An action is an executable statement and a rule must contain at least one action. You code the actions in the main body of the rule using action statements. Each action ends with a semicolon (;), except for an action starting with a FORALL or UNTIL statement that ends with a colon (:). For more information about action statements refer to Chapter 4, Types of Action Statements.
Action Sequence Numbers
Action sequence numbers determine which actions are executed for each particular condition; the same action can be executed for different conditions. An action must have an action sequence number to be executable. If an action occupies more than one line, the action sequence number is associated with the first line of the action only.
Restrictions
Action sequence numbers are not permitted within a FORALL or UNTIL loop. Since a FORALL or UNTIL loop constitutes a single compound statement, all the actions within it are executed whenever the FORALL or UNTIL is executed. Refer to Looping Statements for more information.
Editing Action Sequence Numbers
If the rule contains no conditions, the Rule Editor supplies consecutive numbers. The statements are executed in order from top to bottom. You can edit the numbers, and when you save the rule the Rule Editor renumbers them sequentially. If you delete an action sequence number, the corresponding action is not executed. If the rule contains conditions, you must supply values for the action sequence numbers.
Behavior of Action Sequence Numbers
You can type in an alphanumeric character for each executable action and all the characters are converted into sequenced numbers when you save the rule or press Enter. For example, if you enter 1, 2, A, B, they are changed to 1, 2, 3, 4.
Sample of the Rules Actions

 
_ ------------------------------------------------------------+--------------
_ ....; | Y N N
- ....; | Y N
_ ------------------------------------------------------------+--------------
_ RATE = 0.1; | 1
_ RATE = 0.05; | 1
_ RATE = 0.02; | 1
_ GET EMPLOYEES(REGION) WHERE POSITION = JOBTITLE; | 2
_ FORALL EMPLOYEES(REGION) WHERE POSITION = JOBTITLE: | 2 2 3
_ RAISE = EMPLOYEES.SALARY * RATE; |
_ EMPLOYEES.SALARY = EMPLOYEES.SALARY + RAISE; |
_ CALL REPLACE_SALARY(REGION); |
_ CALL MSGLOG(EMPLOYEES.LNAME || ‘ NOW EARNS ‘ || |
_ EMPLOYEES.SALARY; |
_ END; |
_ ---------------------------------------------------------------------------

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved