Implement
IF statements in COBOL:
Draw
the flowchart and write the pseudocode for each of the problems below.
Employee
File:
Characters |
Field
Name |
Data |
Allowed
codes |
Data
Type |
1-5 |
IDNO |
Identification
Number |
|
Num |
6-25 |
NAME |
Name |
|
Char |
26-29 |
YRBTH |
Year
of Birth |
|
Num |
30 |
GEN
|
Gender |
M, F, U |
Char |
31 |
MARSTAT |
Marital
Status |
S,
M, W, D, U |
Char |
32-33 |
NUMDEP |
Number
of Dependents |
|
Num |
34-36 |
ED |
Education |
NOH,
HSC, GED, C2, C4, M, PHD |
Char |
37 |
JBCD |
Job
Code |
S,
F, P |
Char |
38-42 |
PAYHR |
Pay
per hour for full time and part time |
|
Num
(2 dec) |
43 - 50 |
SAL |
Salary |
|
Num (2 dec) |
51-55 |
BONUS |
Bonus |
|
Num |
56-57 |
DEPT |
Department |
2
digit numeric |
Num |
58-59 |
STATE |
State |
2
char state code |
Char |
Problem
#1: Print
or display a list of all records where the state is equal to either MA or RI.
Problem
#2: Print or display a list of all records where
the year of birth is greater than 1980 and the marital status is married.
Problem
#3: The
list you are printing or displaying should have a message that says SALARIED if
the job code is S should say HOURLY for all other codes.
Problem
#4: Print a list of all people who make a bonus
greater than 5000 and either have a salary greater than 50000 or a pay per hour
greater than 25 per hour.
Problem
#5: Print a
list of all people in department 15 who either are salaried and make more than
60000 or are part time or full time and make more than 25 per hour.
Problem
#6: Print or display a list of all people
and their dept group. If the dept is greater than 16 they are in SALES, if the
dept is between 10 and 15 inclusive they are in FINANCE, if the dept is between
7 and 9 inclusive they are in PAYROLL, otherwise they are in BUSINESS.
Problems
#7: If the person is married and has
more than 5 dependents MOVE MSG-1 TO MSG-PR,
if the person is married and does not have more than 5 dependents MOVE
MSG-2 TO MSG-PR, if the person is not married with more than 4 dependents MOVE
MSG-3 TO MSG-PR, if the person is not married and does not have more than 4
dependents MOVE MSG-4 TO MSG-PR.
Problem
#8: The
list you are printing should meet the following criteria:
·
If
the person is female and married and has more than three dependents print the
message GROUP1
·
If
the person is female and married and has 0, 1, 2, or 3 dependents print the
message GROUP2
·
If
the person is female and not married print the message GROUP3.
·
If
the person is male and married and has more than three dependents print the
message GROUP4
·
If
the person is male and married and has 0, 1, 2, or 3 dependents print the
message GROUP5.
·
If
the person is male and not married print the message GROUP6.
·
If
the gender is not know, print the message GROUP 7.