For
distance learning students:
·
Modify
this program on paper so it displays the total number of salaried employees.
·
Modify
this program on paper so it displays the total number of salaried employees and
the total number of non salaried employees.
·
Modify
this program on paper so it displays the total number of employees.
Lab
assignment if you are in class:
Modify
the program I gave you last week to produce this program. Get it running using
the EMPLOYEE.DAT file I gave you last week (additional copies will be available
in the lab).
IDENTIFICATION DIVISION.
PROGRAM-ID. CIS17lab.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT
EMPLOYEE-FILE
ASSIGN TO "A:\EMPLOYEE.DAT".
DATA DIVISION.
FILE
SECTION.
FD EMPLOYEE-FILE
DATA RECORD IS EMPLOYEE-RECORD.
01 EMPLOYEE-RECORD.
05
IDNO PIC XXXXX.
05
EMPNAME PIC X(20).
05
YRBTH PIC 9(4).
05 GEN PIC X.
05
MARSTAT PIC X.
05
NUMDEP PIC 99.
05
ED PIC XXX.
05
JBCD PIC X.
05
PAYHR PIC 999V99.
05
SAL PIC 9(6)V99.
05
BONUS PIC 9(5).
05
DEPT PIC 99.
05
STATE PIC XX.
WORKING-STORAGE SECTION.
01 PROG-INDICATORS.
05 END-OF-FILE-IND PIC XXX VALUE "NO ".
01 WORK-AREAS.
05 TOTAL-SAL PIC 9(8)V99 VALUE 0.
01 OUTPUT-TO-SCR.
05 SAL-FOR-SCR PIC $$$$,$$$.99.
05 TOTAL-SAL-FOR-SCR PIC $$$,$$$,$$$.99.
PROCEDURE DIVISION.
MAINLINE.
PERFORM A-100-HOUSEKEEPING.
PERFORM B-100-PROCESS.
PERFORM C-100-WRAPUP.
STOP RUN.
A-100-HOUSEKEEPING.
OPEN INPUT EMPLOYEE-FILE.
DISPLAY " " WITH BLANK SCREEN.
DISPLAY " ".
B-100-PROCESS.
READ EMPLOYEE-FILE
AT END
MOVE "YES" TO END-OF-FILE-IND.
PERFORM B-200-LOOP
UNTIL END-OF-FILE-IND = "YES".
B-200-LOOP.
IF
JBCD = "S"
ADD SAL TO TOTAL-SAL
MOVE SAL TO SAL-FOR-SCR
DISPLAY EMPNAME " "
JBCD " " SAL-FOR-SCR
END-IF
READ EMPLOYEE-FILE
AT END
MOVE "YES" TO END-OF-FILE-IND.
C-100-WRAPUP.
DISPLAY " ".
MOVE TOTAL-SAL TO TOTAL-SAL-FOR-SCR.
DISPLAY "TOTAL SALARY FOR SALARIED EMPLOYEES "
TOTAL-SAL-FOR-SCR.
CLOSE EMPLOYEE-FILE.
Next,
do one of the following.
We
will continue to work in this during lab next week so don't worry if you do not
get it all done.