HP 3000 Manuals

Boolean Operators in Conditionals [ COMMUNICATOR 3000 XL, XL Release 1.1 (Core Software Release A.10.00) ] MPE/iX Communicators


COMMUNICATOR 3000 XL, XL Release 1.1 (Core Software Release A.10.00)

Boolean Operators in Conditionals 

Allow the option of including 'AND' and 'OR' operators in the condition
clauses of 'IF', 'WHILE', and 'REPEAT' verbs.

Syntax 

     ...condition [AND|OR condition [AND|OR condition...] ]

Parameters 

condition        Current condition clause syntax.  Refer to the Transact
                 Manual.

AND              Logical conjunction.  The truth value is true if both of
                 the conditions are true; false if one of the conditions
                 is false.

OR               Optional operator.  Logical inclusive OR. The truth
                 value is true if one or both of the conditions are true;
                 false if both of the conditions are false.

Discussion 

This enhancement allows users to create complex conditions for evaluation
by the IF, WHILE, and REPEAT verbs.  The operator precedence for complex
conditions is:

   1.  Arithmetic expressions are evaluated.

   2.  Truth values are established for simple conditions as follows:

       a.  Relation conditions;

       b.  Class conditions.

   3.  Multiple value conditions.

   4.  Truth values are established for complex conditions as follows:

       a.  Establish truth values for AND conditions.

       b.  Establish truth values for OR conditions.

Transact programmers will be able to use parentheses to indicate order of
precedence when evaluating a condition clause.  Multiple value conditions
imply a higher order of precedence.  Evaluation of the condition clause
will terminate as soon as a truth value can be determined.

Example 

     1)  IF (LAST-NAME) = "SMITH" AND (FIRST-NAME) = "JACK" THEN ...

     2)  IF (ACCT-BALANCE) < 0 OR (LOAN-AMOUNT) >= (LOAN-MAX) THEN ...

     3)  IF (RENTAL-OFFICE) = "098","978","656" AND
            (CUST-NO-PREFIX) = (PREFERRED-PREFIX) OR
            (CUST-NAME) = "ABC Inc." THEN ...

     4)  WHILE (BALANCE) < 0 AND STATUS = 0
            DO
              GET(CHAIN) CUST-DETAIL,STATUS;
              LET (BALANCE) = (BALANCE) + (AMOUNT);
            DOEND;

     5)  REPEAT
            DO
              LET (TOTAL-OVERDUE) = (TOTAL-OVERDUE) + (AMT-OVERDUE);
              FIND(SERIAL) CUST-INVOICE,STATUS;
            DOEND
         UNTIL (TOTAL-OVERDUE) > 999999.99 OR
                (TOTAL-OVERDUE) > (MIN-OVERDUE) AND
                (CUST-CODE) = "NEW";


MPE/iX Communicators