|
Answer» EVALUATE Statements are of different types: - Simple EVALUATE: This type of EVALUATE has only one condition for validation. It does so by validating the item in the WHEN phrase, if the item matches, then the statement below the WHEN phrase would get executed.
EVALUATE DAY WHEN 01 DISPLAY 'MONDAY' WHEN 03 DISPLAY 'WEDNESDAY' WHEN 05 DISPLAY 'FRIDAY' WHEN OTHER DISPLAY 'Not alternate'END-EVALUATE- EVALUATE TRUE: This type has boolean expressions and the WHEN PHRASES had logical expressions. If EVALUATE condition is True, then statements under WHEN where logical expression evaluates to TRUE is executed. If none of the WHEN evaluates to TRUE, then WHEN OTHER is executed.
EVALUATE TRUE WHEN WEEKDAY EQUAL 01 DISPLAY 'MONDAY' WHEN WEEKDAY EQUAL 03 DISPLAY 'WEDNESDAY' WHEN WEEKDAY EQUAL 05 DISPLAY 'FRIDAY' WHEN OTHER DISPLAY 'NOT ALTERNATIVE'END-EVALUATE- EVALUATE having THRU: EVALUATE THRU type is used for validating data where values are from a GIVEN range in contiguous and ascending order. The data item in the EVALUATE statement should belong to a range of values specified in the WHEN phrase to execute the statements. If values do not belong to the range, then statements under WHEN OTHER gets executed.
EVALUATE TOTAL-MARKS WHEN 70 THRU 100 DISPLAY 'DISTINCTION' WHEN 50 THRU 69 DISPLAY 'FIRST CLASS' WHEN 30 THRU 49 DISPLAY 'SECOND CLASS' WHEN OTHER DISPLAY 'DID NOT PASS'END-EVALUATE- EVALUATE having multiple WHEN conditions: This type is used for validating data items with a set of different values which require the same action to be performed. The WHEN statements are grouped and a set of steps to be executed is written. If anyone WHEN phrase gets matched, then the statements are executed.
EVALUATE TOTAL-GRADE WHEN 'A' WHEN 'B' WHEN 'C' DISPLAY 'PASS' WHEN OTHER DISPLAY 'DID NOT PASS'END-EVALUATE- EVALUATE having MULTIPLE conditions: This type of EVALUATE is used for validating a set of multiple conditions which are combined by using ALSO. The number of objects in the WHEN phrase should be equal to the number of subjects in EVALUATE. If all expressions specified in WHEN is satisfied, then the statements below that WHEN is executed.
EVALUATE TRUE ALSO TRUE WHEN AGE > 018 ALSO GENDER = 'M' DISPLAY 'Man can Vote' WHEN AGE > 018 ALSO GENDER = 'F' DISPLAY 'Woman can Vote' WHEN AGE > 018 ALSO GENDER = 'U' DISPLAY 'Person can vote' WHEN OTHER DISPLAY 'Cant vote'END-EVALUATE
|