• We've upgraded our forums. Please post any issues/requests in this thread.

Cobol equation help!

Joined
Feb 26, 2008
Messages
4,870 (1.36/day)
Likes
681
Location
Joplin, Mo
System Name Ultrabeast GX2
Processor Intel Core 2 Duo E8500 @ 4.0GHZ 24/7
Motherboard Gigabit P35-DS3L
Cooling Rosewill RX24, Dual Slot Vid, Fan control
Memory 2x1gb 1066mhz@850MHZ DDR2
Video Card(s) 9800GX2 @ 690/1040
Storage 750/250/250/200 all WD 7200
Display(s) 24" DCLCD 2ms 1200p
Case Apevia
Audio Device(s) 7.1 Digital on-board, 5.1 digital hooked up
Power Supply 700W RAIDMAXXX SLI
Software winXP Pro
Benchmark Scores 17749 3DM06
#1
I need help getting a mortgage calculation working on COBOL, the image has what I need exactly, and this is what I have currently:

Code:
               COMPUTE M ROUNDED = P * ( R / 12 ) -
               ( P * (( R / 12)/( 1 - ( 1 + R / 12 )**(12 * N))))
Where M = monthly payment, P = principal, R = rate (IE 0900 = 9%) and N = number of years.

I must be getting a small number, I get 0 for M unless I enter very large numbers (IE P=999,999,999, N=99 years, and R=99%)



Well, that was a rather large image. It was taken on my phone.
 
Last edited:
Joined
Sep 1, 2010
Messages
5,899 (2.22/day)
Likes
6,561
#2
Honestly I have no idea about COBOL nor mortgage but that formula seems wrong. Place where blah ^12*N. It's gotta be blah ^-12*N. Maybe that's why you get wrong answer.

 
Joined
Feb 26, 2008
Messages
4,870 (1.36/day)
Likes
681
Location
Joplin, Mo
System Name Ultrabeast GX2
Processor Intel Core 2 Duo E8500 @ 4.0GHZ 24/7
Motherboard Gigabit P35-DS3L
Cooling Rosewill RX24, Dual Slot Vid, Fan control
Memory 2x1gb 1066mhz@850MHZ DDR2
Video Card(s) 9800GX2 @ 690/1040
Storage 750/250/250/200 all WD 7200
Display(s) 24" DCLCD 2ms 1200p
Case Apevia
Audio Device(s) 7.1 Digital on-board, 5.1 digital hooked up
Power Supply 700W RAIDMAXXX SLI
Software winXP Pro
Benchmark Scores 17749 3DM06
#3
I have fixed it, my equation was correct, but the values that I entered were going in as 9000% instead of 9%. The answer I was getting was monthly payment = 0, so I thought that it was too low, it turns out that at 9000% the number was quite large, and the numbers were getting concatenated to be 0 when the number came out to be millions, but there was only room for 9999.99.
 
Joined
Sep 1, 2010
Messages
5,899 (2.22/day)
Likes
6,561
#4
I see now. There are so many different mortgage formulas. Good to know you've fixed that.