Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program-id. Program1 as "ConsoleApplication6.Program1".
- environment division.
- input-output section.
- file-control.
- select payroll-list assign to "C:\Users\1630488\Desktop\input.txt"
- organization is line sequential.
- select payroll-out assign to "C:\Users\1630488\Desktop\output.txt".
- data division.
- fd payroll-list.
- 01 sales-info.
- 05 sp-number PIC 99.
- 05 sp-name PIC X(20).
- 05 amt-sales PIC 999V99.
- fd payroll-out.
- 01 print-info.
- 05 filler PIC X(15).
- 05 sp-number-out PIC 99.
- 05 filler PIC X(12).
- 05 sp-name-out PIC X(20).
- 05 filler PIC X(5).
- 05 total-sales PIC ZZZZZ.99.
- 05 filler PIC X(19).
- working-storage section.
- 01 stop-go PIC X VALUE "Y".
- 01 date-in.
- 05 curr-year PIC 9(4).
- 05 curr-month PIC 9(2).
- 05 curr-day PIC 9(2).
- 01 header-one.
- 05 filler PIC X(30).
- 05 header-title PIC X(32) VALUE "TOTAL SALES FOR EACH SALESPERSON".
- 05 filler PIC X(4).
- 05 day-out PIC 9(2).
- 05 filler PIC X VALUE "/".
- 05 month-out PIC 9(2).
- 05 filler PIC X VALUE "/".
- 05 year-out PIC 9(4).
- 01 header-two.
- 05 filler PIC X(10).
- 05 no-title PIC X(15) VALUE "SALESPERSON NO.".
- 05 filler PIC X(4).
- 05 name-title PIC X(16) VALUE "SALESPERSON NAME".
- 05 filler PIC X(9).
- 05 sales-title PIC X(11) VALUE "TOTAL SALES".
- 01 header-three.
- 05 filler PIC X(40).
- 05 sales-title2 PIC X(19) VALUE "TOTAL COMPANY SALES".
- 05 filler PIC X(3).
- 05 total-comp-sales PIC 99999999.99.
- 01 Sales-arr.
- 05 salesman OCCURS 20 TIMES.
- 10 arr-sp-name PIC X(20).
- 10 arr-sales PIC 99999V99.
- 01 counter PIC 99.
- 01 temp-total PIC 99999999V99.
- procedure division.
- move function current-date to date-in.
- 100-Main.
- move curr-day to day-out
- move curr-month to month-out
- move curr-year to year-out
- open input payroll-list
- output payroll-out
- perform until stop-go = "N"
- read payroll-list
- at end
- move 'N' to stop-go
- perform 300-Printing
- not at end
- perform 200-Calc
- end-read
- end-perform
- close payroll-list
- payroll-out.
- stop run.
- 200-Calc.
- move sp-name to arr-sp-name(sp-number)
- add amt-sales to arr-sales(sp-number)
- add amt-sales to temp-total.
- 300-Printing.
- write print-info from header-one
- after advancing 1 line
- write print-info from header-two
- perform varying counter from 1 BY 1 until counter >= 21
- move spaces to print-info
- move counter to sp-number-out
- move arr-sp-name(counter) to sp-name-out
- move arr-sales(counter) to total-sales
- move temp-total to total-comp-sales
- write print-info after advancing 1 line
- end-perform
- move total-comp-sales to total-comp-sales
- write print-info from header-three.
- end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement