ILE COBOL Language Reference


EVALUATE Statement

The EVALUATE statement provides a shorthand notation for a series of nested IF statements. It can evaluate multiple conditions. That is, the IF statements can be made up of compound conditions. The subsequent action of the object program depends on the results of these evaluations.

EVALUATE Statement - Format
 
>>-EVALUATE--+-identifier-1-+--+----------------------------+--->
             +-literal-1----+  | .------------------------. |
             +-expression-1-+  | V                        | |
             +-TRUE---------+  '---ALSO--+-identifier-2-+-+-'
             '-FALSE--------'            +-literal-2----+
                                         +-expression-2-+
                                         +-TRUE---------+
                                         '-FALSE--------'
 
   .-----------------------------------------------------------------.
   | .------------------------------------------.                    |
   V V                                          |                    |
>------| WHEN phrase |--+---------------------+-+--imperative-stmt-1-+-->
                        | .-----------------. |
                        | V                 | |
                        '---| ALSO phrase |-+-'
 
>--+-------------------------------+--+--------------+---------><
   '-WHEN OTHER--imperative-stmt-2-'  '-END-EVALUATE-'
 
WHEN phrase:
 
|--WHEN--------------------------------------------------------->
 
>--+-ANY----------------------------------------------------------+--|
   +-condition-1--------------------------------------------------+
   +-TRUE---------------------------------------------------------+
   +-FALSE--------------------------------------------------------+
   '-+-----+--+-identifier-3-+--+-------------------------------+-'
     '-NOT-'  +-literal-3----+  '-+-THROUGH-+--+-identifier-4-+-'
              '-arith-expr-1-'    '-THRU----'  +-literal-4----+
                                               '-arith-expr-2-'
 
ALSO phrase:
 
|--ALSO--------------------------------------------------------->
 
>--+-ANY----------------------------------------------------------+--|
   +-condition-2--------------------------------------------------+
   +-TRUE---------------------------------------------------------+
   +-FALSE--------------------------------------------------------+
   '-+-----+--+-identifier-5-+--+-------------------------------+-'
     '-NOT-'  +-literal-5----+  '-+-THROUGH-+--+-identifier-6-+-'
              '-arith-expr-3-'    '-THRU----'  +-literal-6----+
                                               '-arith-expr-4-'
 
 

Related Information:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]