You add a simple condition by adding the IF action statement. The IF action specifies the conditions under which process actions take place. In its simplest form, IF allows you to compare two objects. To make simple mutually exclusive conditions, you add ELSE conditions to the IF action statement.
An IF action statement for a simple condition:
IF condition 1 action_statement_list_1
The IF action statement for a simple mutually exclusive condition takes the following form:
IF condition_1 action_statement_list_1 [ELSE action_statement_list_2]
The actions inside the bracket are performed only if the condition is not true.
Condition 1 is any of the following expressions that can be either true or false:
The IF statement merely sets up the condition; it does not indicate the actions to be taken when the condition is met. To complete the description, follow the IF statement with one or more action statements. Since an IF statement contains a comparison, it must contain a relational operator such as IS EQUAL TO or IS LESS THAN. The following example shows an IF statement containing a relational operator:
IF processing vendor reference_evaluation IS GREATER OR EQUAL TO 2 MOVE processing vendor TO export vendor
When the IF statement and the ELSE IF condition are not true, conclude the IF statement with an ELSE clause. The actions inside the ELSE bracket are performed only if the condition(s) in the IF statement and all ELSE IF statements are false. For a discussion of ELSE IF actions, see the next section. When you select ELSE, you can add one or more actions to the ELSE block.
The following statement illustrates the use of ELSE with IF:
IF (processing vendor average_delivery_time_in_days)- (competitive vendor average_delivery_time_in_days IS EQUAL TO 0 AND processing vendor reference_ evaluation IS EQUAL TO competitive vendor reference_evaluation IF competitive vendor average_delivery_time_in_days IS LESS OR EQUAL TO 5 MOVE competitive vendor TO preferred vendor ELSE MOVE competitive vendor TO ok vendor
You can also use simple conditions with repeating group views. The following statement illustrates a simple condition that references a subscript and sets a subscript in a repeating group view:
IF SUBSCRIPT OF export_list > MAXIMUM OF export_list SET SUBSCRIPT OF export_list TO MAXIMUM OF export_list SET output customer name TO "Press F5 for More"
You can add an IS VALID expression to an IF condition to check for permitted values. To test whether persistent views can be used for UPDATE, DELETE, ASSOCIATE, or DISASSOCIATE actions, you can add the following expressions:
The expressions IS POPULATED and IS NOT POPULATED test whether a READ statement populated a view. The expressions IS LOCKED and IS NOT LOCKED test whether the view is still locked from a previous READ and may be updated without another READ statement.
Successful READs and CREATEs set the POPULATED flag on. Unsuccessful READs and DELETEs set the flag to off. The flag can be checked with the IF POPULATED / IF NOT POPULATED statements. These statements should be used in Action Diagrams accepting persistent views. If the populated flag is off, a subsequent UPDATE would cause a runtime error, TIRM039E. To protect against this, have a path in your Action Diagram wherein a READ is performed if the Populated flag is off.
If a previously populated view is involved in a subsequent unsuccessful READ, the populated flag is turned off, but the data remains in the view. This can cause more than a little confusion when displaying views using CA Gen Diagram Trace Utility.
The Locked/Unlocked parameter is only for communication during code generation. As a result, something else must ensure at runtime that a lock is established when the used action block is executed. The IF LOCKED/IF NOT LOCKED statements are used to make this test. If the view is not locked and needs to be, you must READ the entity occurrence again or a TIRM039 runtime failure occurs with a DU status code.
|
Copyright © 2014 CA.
All rights reserved.
|
|