skip to main content

Procedure Division Statements : EVALUATE

EVALUATE
General Format
EVALUATE  {Sel-Subject} { [ ALSO {sel-subject} ] } ... 
  { { WHEN Sel-Object { [ ALSO Sel-Object ] } ... } ... Statement-1 } ... 
  [ WHEN OTHER Statement-2 ] 
  [END-EVALUATE]
Where Sel-Subject is:
   { TRUE                                 } 
   { FALSE                                } 
Where Sel-Object is:
   { [IS NOT] Identifier-2                   } 
   { [IS NOT] Literal-2                      } 
   { [IS NOT] Arithmetic-Expression-2        } 
   { [IS NOT] Comparison-Expression          } 
   { [IS NOT] Boolean-Expression-2           } 
   { [IS NOT] Range-Expression               } 
   { TRUE                                 } 
   { FALSE                                } 
   { ANY                                  } 
Where Range-Expression is:
   { Identifier-3            } {THROUGH} { Identifier-4            }
   { Literal-3               } {THRU   } { Literal-4               }
Syntax rules
1.
2.
3.
4.
5.
A.
B.
C.
D.
E.
6.
A.
B.
C.
D.
7.
8.
General rules
1.
2.
A.
B.
C.
D.
E.
F.
3.
A.
i.
ii.
iii.
iv.
v.
 
when 'NOT' is not specified in the selection object;
 
selection-subject >= left-part AND selection-subject <= right-part
 
when 'NOT' is specified in the selection object
 
selection-subject < left-part OR selection-subject > right-part
 
where left-part is identifier-3, literal-3, or arithmetic-expression-3 and right-part is identifier-4, literal-4, or arithmetic-expression-4. The result of the analysis is the truth value of the resulting conditional expression.
vi.
 
selection-subject [NOT] = selection-object
 
where 'NOT' is present if it is present in the selection object. The result of the analysis is the truth value of the resulting conditional expression.
B.
C.
D.
4.
A.
B.
C.
Examples
Evaluate logical expression, check if it is true or false
evaluate 1 = 1
when true display message "Of course, it is True!"
when false display message "No way to be False!"
Evaluate variable, check for different possible ranges of values
evaluate ws-age
when 1 thru 17 display message "Invalid Age for Credit Card Verification!"
when 18 thru 59 display message "Welcome to the Credit Card Verification App!"
when 60 thru 99 display message "Welcome to Senior Card Verification App!"
Evaluate arithmetic expression, check for different possible values
evaluate ws-amount + 1
when 10 display "Ok"
when 11 display "A little bit high"
when 12 display "Value is high"
when 13 thru 99 display "Value is too high"
when other display "Invalid value"

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left