Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluate function

Status
Not open for further replies.

rpt860

MIS
Nov 5, 2010
3
US
Im a writing a very simply program. My goal is to successfully use the evaluate function. I've been battling with one error for about 2 hours. Below is my code. All my errors come from the line where "when 1" is. If any one has any ideas on how i can fix this please let me know. thank you!

IDENTIFICATION DIVISION.
PROGRAM-ID. SALES-TAX.
DATE-WRITTEN. 11/5/10.

WORKING-STORAGE SECTION.

01 STATE PICTURE 99.
01 CT-TAX PICTURE V99 VALUE .06.
01 NY-TAX PICTURE V99999 VALUE .08875.
01 MA-TAX PICTURE V9999 VALUE .0625.
01 TAX PICTURE 99.
01 SALE PICTURE 999.
01 TOTAL PICTURE 999.

PROCEDURE DIVISION.

DISPLAY 'WHAT STATE WOULD YOU LIKE TO'.
DISPLAY 'CALCULATE THE SALES TAX FOR?'.
DISPLAY ' '.
DISPLAY '1.CT'.
DISPLAY '2.NY'.
DISPLAY '3.MA'.
DISPLAY ' '.

ACCEPT STATE.

DISPLAY ' '.

DISPLAY 'HOW MUCH IS YOUR SALE?'.
DISPLAY ' '
ACCEPT SALE.
DISPLAY ' '

EVALUATE STATE
WHEN 1
MULTIPLY CT-TAX BY SALE GIVING TAX.
ADD SALE TAX GIVING TOTAL.
DISPLAY 'TAX IS ' TAX ' AND TOTAL SALE IS ' TOTAL.

WHEN 2
MULTIPLY NY-TAX BY SALE GIVING TAX.
ADD SALE TAX GIVING TOTAL.
DISPLAY 'TAX IS ' TAX ' AND TOTAL SALE IS ' TOTAL.

WHEN 3
MULTIPLY MA-TAX BY SALE GIVING TAX.
ADD SALE TAX GIVING TOTAL.
DISPLAY 'TAX IS ' TAX ' AND TOTAL SALE IS ' TOTAL.

WHEN OTHER DISPLAY 'Data Entry Error'

END-EVALUATE
 
Remove all the periods between EVALUATE and END-EVALUATE and you should have better luck.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top