Mainframes 360
The one stop destination for System Z professionals

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.

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 :


To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.