Conditions

148 Views


A condition specifies the circumstances under which an action, a sequential statement, or an iterative statement are to be executed. Conditions define a particular value for a field.

The following examples demonstrate how conditions control processing.

A condition controlling a simple action would be an instance where, if a field’s condition is met, a simple action takes place.

.- CASE
 | -RCD. *SFLSEL is *SELECT
 | Display record details
 ’- ENDCASE

A condition controlling a sequence of actions would be an instance within a CASE construct where, if a field’s condition is met, a sequence of actions executes.

- CASE
 | -RCD. *SFLSEL is *SELECT
 | .-
 | : Display record details
 | ’-
 ’- ENDCASE

A condition controlling an iterative constant would be an instance within a REPEAT WHILE construct where while a field’s condition is met, a simple action takes place.

= REPEAT WHILE
 | -RCD. Status is Held
 | Display record details
 ’- ENDWHILE

Similarly, you could define multiple conditions within the same CASE construct to test for various conditions and the actions to take.

.- CASE
 | -RCD. *SFLSEL is *SELECT
 | Display record details
 | -RCD. *SFLSEL is *Delete
 | Delete record details
 | -*OTHERWISE
 | Update record details
 ’- ENDCASE

Condition Types

Condition types allow you to define a particular type of processing based on some form of conditional criteria that you specify in the logic of your action diagram.

Synon specifies four different condition types that can be used within an action diagram.

Values (VAL) Conditions Type

The Value Conditions (VAL) type is used for conditions that specify a value that a field can receive. You only use the VAL condition type with status (STS) fields.

Values List (LST) Condition Type

The Values List (LST) Condition type is used for conditions that specify a list of values that a status field can receive.

Each condition list consists of one or more value (VAL) conditions. You can only use the LST condition type for fields of type status (STS).

For fields of type STS, Synon/2E creates a special list condition *ALL VALUES whenever you define field conditions.

Compare (CMP) Condition Type

The Synon/2E Compare (CMP) condition type is used for conditions that specify a scope of values that a field can receive.

The scope of values is defined in terms of a fixed value and an operator.

The fixed value is a Synon/2E field; the operator is a symbol expressing some form of boolean logic.

The following is a valid list of operators:

*EQ equal to 
*NE not equal to 
*GT greater than 
*LT less than 
*GE greater than or equal to 
*LE less than or equal to 
IS for comparison to PGM *Cursor field

You can use the CMP condition type for fields types other than STS.

Examples · Order quantity is GT 10 · Credit limit is LT 1,000.00

Range (RNG) condition type
The Range (RNG) condition type is used for conditions that specify a range of values that a field can receive.

The range of values is defined in terms of two fixed values between which the value must lie including starting and end points.

You can use the RNG condition type for fields types other than STS.

Examples

· Order quantity is between 10 and 100

· Transaction value is GT 25 and LE 250

Compound Conditions

Synon compound conditions provide you with the ability to use complex condition expressions in any context where a simple action diagram condition is used.

Use Boolean logic operations as AND or OR in condition tests.

There are three aspects of compound condition expressions:

1. The ability to AND together or OR together condition tests. For example: (a AND b AND c), (a OR b OR c)

2. The ability to parenthesize and mix logical operators. For example: (a AND b) OR (c AND d)

3. The ability to test negation. For example: (a AND b) OR NOT c

Synon/2E provides the following default logical operators for use with compound conditions:

& AND operator

| OR operator

( left parenthesis

) right parenthesis

! NOT operator

Defining Compound Conditions

1. Zoom into the user points. At the Edit Action Diagram panel, press F5 to view the user points for the function. The Edit User Exit Points window displays.

2. Zoom into a selected user point. Type Z next to the selected user point and press Enter.

The next level of the action diagram displays.

3. Insert a CASE condition. Type IC at the selected point and press Enter. The new case displays.

4. Zoom into the condition. Type FF next to the new condition and press Enter. The Edit Action - Condition Window displays.

5. Define the compound condition. Press F7. The Edit Action - Compound Condition panel displays.

6. Enter the compound condition using the logical operators mentioned above.

7. Enter the condition variables on the input-capable line.

Post Comments