IDENTIFICATION DIVISION. PROGRAM-ID. REPRTGEN. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT VSAM-FILE ASSIGN TO "C:\PCOBWIN\CIS52FST\RPTSCRVS.DAT" ORGANIZATION IS INDEXED ACCESS IS SEQUENTIAL RECORD KEY IS VSAM-KEY. SELECT PRINT-FILE ASSIGN TO PRINTER. DATA DIVISION. FILE SECTION. FD VSAM-FILE DATA RECORD IS VSAM-REC. 01 VSAM-REC. 05 VSAM-KEY. 10 VSAM-DIV-NO PIC 99. 10 VSAM-BR-NO PIC 99. 10 VSAM-DEPT-NO PIC 99. 10 VSAM-ID-NO PIC 9999. 05 VSAM-NAME PIC X(20). 05 VSAM-ADR PIC X(20). 05 VSAM-CITY PIC X(15). 05 VSAM-STATE PIC XX. 05 VSAM-ZIP PIC 9(5). 05 VSAM-JOB-CODE PIC X. 05 VSAM-PAY-HR PIC 999V99. 05 VSAM-SALARY PIC 9(6)V99. FD PRINT-FILE REPORT IS EMPLOYEE-REPORT. WORKING-STORAGE SECTION. 01 INDICATORS. 05 MORE-RECS PIC XXX VALUE "YES". 01 WORK-AREAS. 05 SALARY-WS PIC 9(6)V99 VALUE 0. 01 CONSTANTZ. 05 HOURS-IN-YEAR PIC 9999 VALUE 2080. REPORT SECTION. RD EMPLOYEE-REPORT CONTROLS ARE FINAL VSAM-DIV-NO VSAM-BR-NO VSAM-DEPT-NO PAGE LIMIT IS 24 LINES HEADING 1 FIRST DETAIL 5 LAST DETAIL 15 FOOTING 19. 01 TYPE IS PAGE HEADING. 05 LINE 1. 10 COLUMN 30 PIC X(15) VALUE "EMPLOYEE REPORT". 05 LINE 3. 10 COLUMN 2 PIC XXX VALUE "DIV". 10 COLUMN 6 PIC XX VALUE "BR". 10 COLUMN 9 PIC XXXX VALUE "DEPT". 10 COLUMN 14 PIC XXXX VALUE "ID #". 10 COLUMN 20 PIC XXXX VALUE "NAME". 10 COLUMN 40 PIC X(6) VALUE "JOB CD". 10 COLUMN 47 PIC X(6) VALUE "PAY/HR". 10 COLUMN 60 PIC X(6) VALUE "SALARY". 01 EMPLOYEE-LINE TYPE IS DETAIL LINE IS PLUS 1. 05 COLUMN 3 PIC Z9 SOURCE VSAM-DIV-NO. 05 COLUMN 6 PIC Z9 SOURCE VSAM-BR-NO. 05 COLUMN 10 PIC Z9 SOURCE VSAM-DEPT-NO. 05 COLUMN 14 PIC 9999 SOURCE VSAM-ID-NO. 05 COLUMN 20 PIC X(20) SOURCE VSAM-NAME. 05 COLUMN 43 PIC X SOURCE VSAM-JOB-CODE. 05 COLUMN 46 PIC $ZZ.99 SOURCE VSAM-PAY-HR. 05 COLUMN 55 PIC $$$Z,ZZZ.99 SOURCE SALARY-WS. 01 DEPT-TOTAL-LINE TYPE IS CONTROL FOOTING VSAM-DEPT-NO LINE IS PLUS 2 NEXT GROUP IS PLUS 1. 05 COLUMN 20 PIC X(21) VALUE "TOTAL FOR DEPARTMENT ". 05 COLUMN 41 PIC XX SOURCE VSAM-DEPT-NO. 05 COLUMN 53 PIC $$,$$Z,ZZZ.99 SUM SALARY-WS. 01 BR-TOTAL-LINE TYPE IS CONTROL FOOTING VSAM-BR-NO LINE IS PLUS 1 NEXT GROUP IS PLUS 1. 05 COLUMN 20 PIC X(17) VALUE "TOTAL FOR BRANCH ". 05 COLUMN 37 PIC XX SOURCE VSAM-BR-NO. 05 COLUMN 52 PIC $$$,$$Z,ZZZ.99 SUM SALARY-WS. 01 DIV-TOTAL-LINE TYPE IS CONTROL FOOTING VSAM-DIV-NO LINE IS PLUS 1 NEXT GROUP IS PLUS 1. 05 COLUMN 20 PIC X(19) VALUE "TOTAL FOR DIVISION ". 05 COLUMN 39 PIC XX SOURCE VSAM-DIV-NO. 05 COLUMN 51 PIC $$$$,$$Z,ZZZ.99 SUM SALARY-WS. 01 FINAL-TOTAL-LINE TYPE IS CONTROL FOOTING FINAL LINE IS PLUS 1. 05 COLUMN 20 PIC X(11) VALUE "FINAL TOTAL". 05 COLUMN 49 PIC $$,$$$,$$Z,ZZZ.99 SUM SALARY-WS. PROCEDURE DIVISION. MAINLINE. PERFORM A-100-INITIALIZE. PERFORM B-100-PROCESS. PERFORM C-100-TERMINATE. STOP RUN. A-100-INITIALIZE. OPEN INPUT VSAM-FILE OUTPUT PRINT-FILE. INITIATE EMPLOYEE-REPORT. B-100-PROCESS. READ VSAM-FILE AT END MOVE "NO " TO MORE-RECS. PERFORM B-200-LOOP UNTIL MORE-RECS = "NO ". B-200-LOOP. IF VSAM-PAY-HR NOT EQUAL TO 0 MULTIPLY VSAM-PAY-HR BY HOURS-IN-YEAR GIVING SALARY-WS ELSE MOVE VSAM-SALARY TO SALARY-WS. GENERATE EMPLOYEE-LINE. READ VSAM-FILE AT END MOVE "NO " TO MORE-RECS. C-100-TERMINATE. TERMINATE EMPLOYEE-REPORT. CLOSE VSAM-FILE PRINT-FILE.