|
|
|
| I can't compile it successfully. Anyone can help me.
Identification Division.
Program-ID. MT269-TMA02-Q2.
Author. Ng Tsum Sum.
Environment Division.
Data Division.
Working-Storage Section.
01 Program-Constant.
05 income PIC 9(7).
05 donations PIC 9(7).
05 chargeableincome PIC 9(7).
05 taxpayable PIC Z(7).
05 displaytax PIC Z(7).99.
Procedure Division.
Display 'Please enter your annual income:' Line 10 Column 20.
Accept income Line 10 Column 53.
Display 'Please enter your charitable donations:' Line 12 Column
20.
Accept donations Line 12 Column 53.
Compute chargeableincome = income - 100000 - donations.
Evaluate chargeableincome > 0
When chargeableincome <= 30000
Compute taxpayable = chargeableincome * 2 / 100
When chargeableincome > 30000 AND chargeableincome <= 60000
Compute taxpayable = 30000 * 2 / 100 + (chargeableincome - 30000)
* 8 / 100
When chargeableincome > 60000 AND chargeableincome <= 90000
Compute taxpayable = 30000 * 2 / 100 + 30000 * 8 / 100 +
(chargeableincome - 60000) * 14 / 100
When chargeableincome > 90000
Compute taxpayable = 30000 * 2 / 100 + 30000 * 8 / 100 +
30000 * 14 / 100 + (chargeableincome - 90000) * 20 / 100
End-Evaluate.
If chargeableincome < 0
Move 0 to taxpayable
END-IF.
Move taxpayable to displaytax.
Display 'Your annual income:' Line 14 Column 20.
Display income Line 14 Column 35.
Display 'Your charitable donations : ' Line 16 Column 20.
Display donations Line 16 Column 35.
Display 'Tax payable: ' Line 18 Column 20.
Display displaytax Line 18 Column 35.
Stop Run.
| |
| William M. Klein 2004-06-25, 6:50 pm |
| What compiler?
What happens when you try and compile it? (What error message do you get?)
--
Bill Klein
wmklein <at> ix.netcom.com
"Sum" <sum1111@i-cable.com> wrote in message
news:74f8a837.0406212000.774c43b8@posting.google.com...
> I can't compile it successfully. Anyone can help me.
>
> Identification Division.
> Program-ID. MT269-TMA02-Q2.
> Author. Ng Tsum Sum.
>
> Environment Division.
>
> Data Division.
>
> Working-Storage Section.
> 01 Program-Constant.
> 05 income PIC 9(7).
> 05 donations PIC 9(7).
> 05 chargeableincome PIC 9(7).
> 05 taxpayable PIC Z(7).
> 05 displaytax PIC Z(7).99.
>
> Procedure Division.
> Display 'Please enter your annual income:' Line 10 Column 20.
> Accept income Line 10 Column 53.
>
> Display 'Please enter your charitable donations:' Line 12 Column
> 20.
> Accept donations Line 12 Column 53.
>
> Compute chargeableincome = income - 100000 - donations.
>
> Evaluate chargeableincome > 0
> When chargeableincome <= 30000
> Compute taxpayable = chargeableincome * 2 / 100
> When chargeableincome > 30000 AND chargeableincome <= 60000
> Compute taxpayable = 30000 * 2 / 100 + (chargeableincome - 30000)
> * 8 / 100
> When chargeableincome > 60000 AND chargeableincome <= 90000
> Compute taxpayable = 30000 * 2 / 100 + 30000 * 8 / 100 +
> (chargeableincome - 60000) * 14 / 100
> When chargeableincome > 90000
> Compute taxpayable = 30000 * 2 / 100 + 30000 * 8 / 100 +
> 30000 * 14 / 100 + (chargeableincome - 90000) * 20 / 100
> End-Evaluate.
>
> If chargeableincome < 0
> Move 0 to taxpayable
> END-IF.
>
> Move taxpayable to displaytax.
> Display 'Your annual income:' Line 14 Column 20.
> Display income Line 14 Column 35.
> Display 'Your charitable donations : ' Line 16 Column 20.
> Display donations Line 16 Column 35.
> Display 'Tax payable: ' Line 18 Column 20.
> Display displaytax Line 18 Column 35.
> Stop Run.
| |
| Frederico Fonseca 2004-06-25, 6:50 pm |
| On 21 Jun 2004 21:00:56 -0700, sum1111@i-cable.com (Sum) wrote:
>I can't compile it successfully. Anyone can help me.
>
>Identification Division.
> Program-ID. MT269-TMA02-Q2.
> Author. Ng Tsum Sum.
>
> Environment Division.
>
> Data Division.
>
> Working-Storage Section.
> 01 Program-Constant.
> 05 income PIC 9(7).
> 05 donations PIC 9(7).
> 05 chargeableincome PIC 9(7).
> 05 taxpayable PIC Z(7).
> 05 displaytax PIC Z(7).99.
>
> Procedure Division.
> Display 'Please enter your annual income:' Line 10 Column 20.
> Accept income Line 10 Column 53.
>
> Display 'Please enter your charitable donations:' Line 12 Column
>20.
> Accept donations Line 12 Column 53.
>
> Compute chargeableincome = income - 100000 - donations.
>
I suspect the error will be related to this evaluate. something does
not seem to be TRUE here.
> Evaluate chargeableincome > 0
> When chargeableincome <= 30000
> Compute taxpayable = chargeableincome * 2 / 100
> When chargeableincome > 30000 AND chargeableincome <= 60000
> Compute taxpayable = 30000 * 2 / 100 + (chargeableincome - 30000)
>* 8 / 100
> When chargeableincome > 60000 AND chargeableincome <= 90000
> Compute taxpayable = 30000 * 2 / 100 + 30000 * 8 / 100 +
>(chargeableincome - 60000) * 14 / 100
> When chargeableincome > 90000
> Compute taxpayable = 30000 * 2 / 100 + 30000 * 8 / 100 +
>30000 * 14 / 100 + (chargeableincome - 90000) * 20 / 100
> End-Evaluate.
>
> If chargeableincome < 0
> Move 0 to taxpayable
> END-IF.
>
> Move taxpayable to displaytax.
> Display 'Your annual income:' Line 14 Column 20.
> Display income Line 14 Column 35.
> Display 'Your charitable donations : ' Line 16 Column 20.
> Display donations Line 16 Column 35.
> Display 'Tax payable: ' Line 18 Column 20.
> Display displaytax Line 18 Column 35.
> Stop Run.
Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com
| |
| Peter Wall 2004-06-28, 3:55 pm |
|
Actually, it does compile. So, as Bill asked, what errors are you
seeing?
In article <74f8a837.0406212000.774c43b8@posting.google.com>, sum1111@i-
cable.com says...
> I can't compile it successfully. Anyone can help me.
>
> Identification Division.
> Program-ID. MT269-TMA02-Q2.
> Author. Ng Tsum Sum.
>
> Environment Division.
>
> Data Division.
>
> Working-Storage Section.
> 01 Program-Constant.
> 05 income PIC 9(7).
> 05 donations PIC 9(7).
> 05 chargeableincome PIC 9(7).
> 05 taxpayable PIC Z(7).
> 05 displaytax PIC Z(7).99.
>
> Procedure Division.
> Display 'Please enter your annual income:' Line 10 Column 20.
> Accept income Line 10 Column 53.
>
> Display 'Please enter your charitable donations:' Line 12 Column
> 20.
> Accept donations Line 12 Column 53.
>
> Compute chargeableincome = income - 100000 - donations.
>
> Evaluate chargeableincome > 0
> When chargeableincome <= 30000
> Compute taxpayable = chargeableincome * 2 / 100
> When chargeableincome > 30000 AND chargeableincome <= 60000
> Compute taxpayable = 30000 * 2 / 100 + (chargeableincome - 30000)
> * 8 / 100
> When chargeableincome > 60000 AND chargeableincome <= 90000
> Compute taxpayable = 30000 * 2 / 100 + 30000 * 8 / 100 +
> (chargeableincome - 60000) * 14 / 100
> When chargeableincome > 90000
> Compute taxpayable = 30000 * 2 / 100 + 30000 * 8 / 100 +
> 30000 * 14 / 100 + (chargeableincome - 90000) * 20 / 100
> End-Evaluate.
>
> If chargeableincome < 0
> Move 0 to taxpayable
> END-IF.
>
> Move taxpayable to displaytax.
> Display 'Your annual income:' Line 14 Column 20.
> Display income Line 14 Column 35.
> Display 'Your charitable donations : ' Line 16 Column 20.
| |
| Harald Cordes 2004-06-29, 8:55 am |
| sum1111@i-cable.com (Sum) wrote in message
....
> Display 'Please enter your charitable donations:' Line 12 Column
> 20.
0000000001111111111222222222233333333334
4444444445555555555666666666677777
123456|89 123456789 123456789 123456789 123456789 123456789 123456789 12|4
cccccciaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcc
respect the margins.
in COBOL 85, the procedure division statements must be in area B
in COBOL 2002 fixed format (default) can be coded from position 8 to 72.
Harald Cordes
|
|
|
|