if statement - Syntax error in COBOL program, unexpected if -


i coding in cobol, , after adding if statement listed below, kept getting " in paragraph '000-main': error: syntax error, unexpected if"

   identification division.    program-id. lab2.      *this program generate statement single investment   *that compounds interest monthly.   *  prompt use 3 inputs, calculate total interest   *  earned, final balance, & entire account balance schedule.   *  display output console.    environment division.    data division.    working-storage section.    01  invest-amt     pic s9(9)v99.     01  invest-error-msg      pic x(40) value "investment "    &     "amount must positive".     01  int-rate        pic s9(2)v99.    01  int-rate-error-msg    pic x(40) value "annual interest "    &     "rate must positive".     01  int-rate-final  pic 9v99999.      01  num-months   pic s9(3).    01  num-months-error-msg  pic x(40) value "number of months "    &     "must positive".       01  multiply-rate pic 9v99999.     01  blank-line     pic x value " ".      01  month-counter   pic 99 value 1.    01  balance-month   pic 9(9)v99.    01  interest-month  pic 9(9)v99.     01  total-interest  pic 9(9)v99.    01  final-balance   pic 9(9)v99.     01  additional-value  pic s9(9)v99.    01  add-value-error-msg  pic x(40) value "additional value "    &     "must positive".      01  q           pic 9(3).    01  r           pic 9(3).    01  months-in-year pic 9(2) value 12.      procedure division.    000-main.        perform 100-initialize         perform until invest-amt >=0            display invest-error-msg           perform 200-input        end-perform         perform 210-input-rate         perform until int-rate >=0           display int-rate-error-msg           perform 210-input-rate        end-perform         perform 220-input-month         perform until num-months >=0           display num-months-error-msg           perform 220-input-month        end-perform         perform 230-input-additional-value         perform until additional-value >=0           display add-value-error-msg           perform 230-input-additional-value        end-perform         perform 300-print-words         perform 400-process-interest        perform 310-print-values        display blank-line         perform until month-counter = num-months           add 1 month-counter            divide month-counter months-in-year giving q remainder r 

everything compiling fine until added if statement below.

          if ( (num-months> months-in-year) & (r=0))              add additional-value balance-month            multiply month-counter months-in-year             add interest-month balance-month rounded           perform 400-process-interest           perform 310-print-values           display blank-line        end-perform 

my compiler complained of missing end-if , didn't &. fixed & problems in obvious way.

inserting end-if after add additional-value balance-month seemed produce clean compile. naturally, final end-perform needed full stop

end-perform.

i suspect compiler producing message because if statement malformed.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -