Home page  
Help >
CalcObject Statement: If
Version 7.11
CalcObject Statement: If CalcObject Statement: If
    Syntax: IF <logical expression>
            IF <logical expression> <statement>
    Options:
       /K - case sensitive compare
    Placement: RETURN Section, EVERY Section, ATEND Section
    Description: Performs the predicate statement and/or 
       subsequent statements if the evaluated <logical expression>
       is true. If an optional ELSE clause is present, it is  
       performed if the evaluated <logical expression> is false.
 
       The scope of an IF statement ends on a matching ENDIF,  
       an EVERY, ATEND or R_INITIAL Statement.
 
       IF and WHILE statements may be nested to a maximum of 16 levels.
 
       A <logical expression> may consist of a single
       <relational expression> or of multiple <relational expression>s
       connected by <logical operator>s.
 
       Legal logical operators for <logical expression> are:
          NOT         unary NOT
          AND         logical AND
          OR          logical OR
          EXCEPT      logical AND NOT   
 
       A <relational expression> consists of two <operand>s
       connected by a <relational operator>. Each <operand> may
       be either a simple string operand or an <arithmetic expression>.
 
       Legal <relational operator>s for <relational expression> are:
          eq  =      equals
          ne         not equals
          ge  >=     greater or equals
          gt  >      greater
          le  <=     less or equals
          lt  <      less
          sv         starting value
          av         all value
          lk         SQL LIKE
 
       If both <operand>s of a <relational expression> are simple
       string operands, the relation is treated as a string 
       comparison; otherwise, both <operand>s are evaluated as 
       <arithmetic expression>s, as described in the CALC Statement,
       and the relation is treated as a numeric comparison.
 
       A string comparison compares two strings character-by-character;
       if the two strings are of unequal length, the shorter string
       is considered to be padded with blanks. Two characters are 
       compared by comparing their ASCII codes; thus "A" (code 65) is 
       less than "B" (code 66).
 
       (Note that only a unary plus is required to transform a
       simple string operand into an arithmetic expression.
       For example, 
          IF "ABC123" = "123ABC"
       is a string compare with a false result. However,
          IF +"ABC123" = +"123ABC"
       is a numeric compare with a true result.)

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.