Page 1 of 1

cobol program

PostPosted: Fri Apr 26, 2013 1:03 am
by pearl
I want to write a simple only-cobol program such that when joining date is below 01-01-2005 , the salary is credited with 5000 and if the date is above 01-01-2005, then salary is credited with 2000.

In the first condition,
if yyyy < 2005
update by 5000

But, I don't know how to give the 2nd condition.
Please help.

Re: cobol program

PostPosted: Fri Apr 26, 2013 1:14 am
by Akatsukami
Note that the statement you've made implies that if join date is equal to 1 January 2005, salary is to remain unchanged. Is that correct?

Re: cobol program

PostPosted: Fri Apr 26, 2013 1:19 am
by Robert Sample
There is a link to manuals at the top of this page. Click on that link, find the COBOL Language Reference manual, and read up on the IF statement -- paying particular attention to the ELSE clause.

Re: cobol program

PostPosted: Fri Apr 26, 2013 2:42 am
by c62ap90
Something like...
IF  ccyy < 2005
    ADD 5000 TO salary
ELSE
    ADD 2000 TO salary
END-IF

Re: cobol program

PostPosted: Tue Apr 30, 2013 5:30 pm
by Anuj Dhawan
pearl wrote:I want to write a simple only-cobol program such that when joining date is below 01-01-2005 , the salary is credited with 5000 and if the date is above 01-01-2005, then salary is credited with 2000.
You're talking about Date here. And later in your code you show only the year.
if yyyy < 2005
update by 5000
:?

As per your rules, even if the joining date is 02-01-2005 then also the salary should be 2000. So, only the year is enrough?