In the EVALUATE Statement, the subject and object may equate to one of the below - 1) TRUE or FALSE – The subject or object may contain TRUE/FALSE constant. Also, if the Subject or object is condition, then its value would be either true or false. 2) A Value – The subject or object may specify an expression(A + B – C) or variables like AGE, whose result is a definite value. Moreover, it may also specify a literal-data value directly like 35. 3) A range of values – The object may also be specified as a range of values, for example, to specify a range or values (3,4,5,..,7), you could simply write 3 THRU 7. |
Suppose you want to write a COBOL Program, to calculate your income-tax payable in India for the financial year 2009-10, as per the slab in which your income falls. RATE-OF-TAX
| STATUS | TAX-SLAB | 0 percent | MALE | 0-1,60,000 | | FEMALE | 0-1,90,000 | | SENIOR-CITIZEN | 0-2,40,000 | 10 percent | MALE | 1,60,001-3,00,000 | | FEMALE | 1,90,001-3,00,000 | | SENIOR-CITIZEN | 2,40,001-3,00,000 | 20 percent | ANY | 3,00,001-5,00,000 | 30 percent | ANY | 5,00,001 and above | The necessary working-storage variables for the above COBOL Program are as shown below-
The EVALUATE statement in COBOL, which calculates the Income-tax according to the above given rules, is as follows :
In the above COBOL Program, I have assumed that the taxable income of the individual is 2.5 lacs, and she is female. 2.5 lacs salary for a female falls into the second tax slab, where the income tax rate is 10 percent. Upon running the above COBOL Program, you should get the following output :
|