What’s new at MAINFRAMES 360
(Updates May '11)...
- We are a cosmopolitan community of 400 members, from around the globe.
- Working on writing and publishing articles on CICS.
- Special article on "How do I learn Mainframe Programming"

Thursday, January 7, 2010

EVALUATE Statement – Part II


Q. What values the Subject and Object in the EVALUATE and WHEN Clauses can take?
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.
Q. Could you explain the above idea simple and easy-to-remember example?
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-
Image65[3]

The EVALUATE statement in COBOL, which calculates the Income-tax according to the above given rules, is as follows :

Image66[2]

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 :

Image67[2]
Related Posts Plugin for WordPress, Blogger...

Note :

Protected by Copyscape Online Copyright Protection
© Copyright – Quasar Chunawalla, 2010.
Note : The copyrights of all the material, text and pictures posted in this website belong to the author. Any instance of lifting the material from this website, shall be considered as an act of plagiarism. For any clarifications, please drop me a line at
 
back to top