cobol program



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

cobol program

Postby pearl » Fri Apr 26, 2013 1:03 am

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.
pearl
 
Posts: 21
Joined: Fri Mar 15, 2013 12:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: cobol program

 

Re: cobol program

Postby Akatsukami » Fri Apr 26, 2013 1:14 am

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?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: cobol program

Postby Robert Sample » Fri Apr 26, 2013 1:19 am

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.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: cobol program

Postby c62ap90 » Fri Apr 26, 2013 2:42 am

Something like...
IF  ccyy < 2005
    ADD 5000 TO salary
ELSE
    ADD 2000 TO salary
END-IF
c62ap90
 
Posts: 125
Joined: Thu Oct 11, 2012 10:24 pm
Has thanked: 1 time
Been thanked: 6 times

Re: cobol program

Postby Anuj Dhawan » Tue Apr 30, 2013 5:30 pm

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?
Anuj
Anuj Dhawan
 
Posts: 274
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post