## cobol salary calculation

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

### cobol salary calculation

Hi Everyone,
Can anyone help me as I have a problem--i.e, How to calculate salary of all employees belonging to same designation. As I have multiple designations to calculate in the same manner. Its urgent.
arjun kumar

Posts: 5
Joined: Tue Dec 13, 2011 12:30 pm
Has thanked: 0 time
Been thanked: 0 time

### Re: cobol salary calculation

We do not do 'urgent' (read the rules).
How much are you willing to pay for someone to write this programs - or series of programs - for you?
What have you tried - where are you stuck?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator

Posts: 3004
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

### Re: cobol salary calculation

As I am a beginner I want to learn how to calculate designation wise thats all
arjun kumar

Posts: 5
Joined: Tue Dec 13, 2011 12:30 pm
Has thanked: 0 time
Been thanked: 0 time

### Re: cobol salary calculation

First define 'designation'
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator

Posts: 3004
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

### Re: cobol salary calculation

EMP-TOT-SALARY IS VARIABLE THAT I DEFINED
EMP-SALARY IS IN INPUT FILE EMPLOYEE SALARY
TL-SAL IS ALSO VARIABLE THAT I DEFINED
SALARY IS OUTPUT FILE EMPLOYEE RECORD------WILL THIS LOGIC WORK----MY DESIRED OUTPUT IS TOTAL 'TL' DESIGNATION EMPLOYEE SALARIES ALL TOGETHER

LOGIC:
EMP-TOT-SAL = EMP-TOT-SAL + EMP-SALARY
MOVE EMP-TOT-SAL TO TL-SAL
MOVE TL-SAL TO SALARY
arjun kumar

Posts: 5
Joined: Tue Dec 13, 2011 12:30 pm
Has thanked: 0 time
Been thanked: 0 time

### Re: cobol salary calculation

No.

You have no conditional logic.

What you will get in SALARY is a "running total" (the total so far when the move was done for that output record).

You either need a table of designations/amount for designation or you need the file pre-sorted on designation. You'll need at least one IF either way.
BillyBoyo
Global moderator

Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

### Re: cobol salary calculation

Yes, I have few designations like AM,BM,CM,DM and their salaries in a given input table.
I defined these deignations in my ws-section.
I want to calculate total salary of employees per designation wise in sorted order
arjun kumar

Posts: 5
Joined: Tue Dec 13, 2011 12:30 pm
Has thanked: 0 time
Been thanked: 0 time

### Re: cobol salary calculation

You make a table with designation and sum total in each entry.

Accumulate sum total per current designation. When designation changes, put the previous designation and sum into the table. Initialise sum to current value and store new designaiton. Continue until end.

At the end of all your input you will have a table of sums by designation, which you can do whatever you then want with.

If you input is not sorted on designation you will need to do the accumulation in the table, have found a matching entry for designation or, if no matching entry, create a new one.
BillyBoyo
Global moderator

Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

### Re: cobol salary calculation

Ya, Iam doing the same but couldn't get the logic for that as u said like When designation changes, put the previous designation and sum into the table. Initialise sum to current value and store new designaiton. Continue until end. Can u give idea abt the logic to write. thank u for suggestions till now.
arjun kumar

Posts: 5
Joined: Tue Dec 13, 2011 12:30 pm
Has thanked: 0 time
Been thanked: 0 time

### Re: cobol salary calculation

if current-designation equal to previous-designation
move previous-designation to designation of next entry in table
move salary-value to salaray of next entry in table
move current-designation to previous-designation
move current-salary to salary-value
else
BillyBoyo
Global moderator

Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Next