Summary Analysis application
Lab 9

Create a COBOL application that will only have a summary report for analysis of gender and marital status inequities. The data file has the following specifications:

columns 1 - 4 - Employee ID number (not used)
columns 5 - 16 - Employee First name (not used)
columns 17 - 31 - Employee Last name (not used)
columns 32 - 36 - Employee gross salary (pic 9(5)) - used
column 37 - Marital status (S - single; M - married) - used
column 38 - Gender (F - female; M - male) - used

This type of processing is common with most businesses as they need to analyze gender and pay equity issues.  This can get long, but the logic is fairly straight forward - and you can "copy-and-paste" [and modify after copying] much of the code.  It is HIGHLY recommended that you plan your code before writing this lab!!!

 

Create a report similar to this:

           GROUP:                            COUNT         AVERAGE

          SINGLE EMPLOYEES                    Z9        $$$,$$9.99

          MARRIED EMPLOYEES                   Z9        $$$,$$9.99

          FEMALE EMPLOYEES                    Z9        $$$,$$9.99

          MALE EMPLOYEES                      Z9        $$$,$$9.99

          SINGLE FEMALES                      Z9        $$$,$$9.99

          SINGLE MALES                        Z9        $$$,$$9.99

          MARRIED FEMALES                     Z9        $$$,$$9.99

          MARRIED MALES                       Z9        $$$,$$9.99

          ALL EMPLOYEES                      ZZ9        $$$,$$9.99

 

To accomplish this lab, you will need an abundance of counters and accumulators:   (remember to initialize all counters and accumulators to zero in the working-storage section!)

SINGLE-MALE-COUNT
MARRIED-MALE-COUNT
SINGLE-FEMALE-COUNT
MARRIED-MALE-COUNT

SINGLE-COUNT
MARRIED-COUNT

MALE-COUNT
FEMALE-COUNT

OVERALL-COUNT

SINGLE-MALE-TOTAL
MARRIED-MALE-TOTAL
SINGLE-FEMALE-TOTAL
MARRIED-FEMALE-TOTAL

SINGLE-TOTAL
MARRIED-TOTAL

MALE-TOTAL
FEMALE-TOTAL

OVERALL-TOTAL

Modularization:
Your IF statements need to be fairly clear and straight forward to accomplish this lab - be careful with ELSE statements that may not hold the correct values.

IF MARITAL-IN = "S" AND GENDER-IN = "F"
    ADD 1 TO SINGLE-FEMALE-COUNT
    ADD SALARY-IN TO SINGLE-FEMALE-TOTAL
END-IF

(an else statement above would actual be dealing with everyone except single females - such as single males, married males, and married females.  It is better to have your IF statements without ELSE's in this application - longer and clear are better than shorter and not as clear!)

Additionally . . .

This lab will have a lot of summary output lines!!!  You may want to develop one - then copy-and-paste - but make sure that you change the variable names appropriately!!!!

 

Here is the data file:

Here is my output:

Return to main COBOL I webpage: