Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- identification division.
- program-id. Program1.
- environment division.
- input-output section.
- select sales-trans assign to "C:\temp\sales-trans.txt"
- organization is line sequential.
- select sales-report assign to "C:\temp\sales-report.txt"
- organization is line sequential.
- configuration section.
- data division.
- file section.
- fd sales-trans.
- 01 sales-file.
- 05 salesperson-no pic 99.
- 05 salesperson-name pic x(20).
- 05 amt-of-sales pic 999v99.
- fd sales-report.
- 01 sales-record.
- 05 pic x(17).
- 05 salesperson-no-out pic 99.
- 05 pic x(12).
- 05 salesperson-name-out pic x(20).
- 05 pic x(5).
- 05 salesperson-sales pic $zz,zzz.99.
- 05 pic x(16).
- working-storage section.
- 01 top-heading.
- 05 pic x(33) value spaces.
- 05 pic x(32) value
- "TOTAL SALES FOR EACH SALESPERSON".
- 05 pic x(4) value spaces.
- 05 the-date.
- 10 c-day pic xx/.
- 10 c-month pic xx/.
- 10 c-year pic xxxx.
- 05 pic x(3) value spaces.
- 01 record-heading.
- 05 pic x(12) value spaces.
- 05 pic x(15) value "SALESPERSON NO.".
- 05 pic x(4) value spaces.
- 05 pic x(16) value "SALESPERSON NAME".
- 05 pic x(9) value spaces.
- 05 pic x(11) value "TOTAL SALES".
- 05 pic x(15) value spaces.
- 01 total-sales-heading.
- 05 pic x(42) value spaces.
- 05 pic x(19) value
- "TOTAL COMPANY SALES".
- 05 pic x(3) value spaces.
- 05 total-sales-out pic $$,$$$,$$$.99.
- 05 pic x value spaces.
- 05 pic x value "*".
- 05 pic x(3) value spaces.
- 01 temp-date.
- 05 temp-year pic x(4).
- 05 temp-month pic x(2).
- 05 temp-day pic x(2).
- 01 total-sales pic 9(9).
- 01 i pic 99 value 0.
- 01 slsprs.
- 05 s-name occurs 20 times pic x(20).
- 05 s-sales occurs 20 times pic 99999v99.
- 01 eof pic x value "Y".
- procedure division.
- 100-main.
- open input sales-trans output sales-report
- perform 150-write-headings
- perform until eof = "N"
- read sales-trans
- at end move "N" to eof
- not at end
- perform 300-fill-array
- end-perform
- perform 250-write-record
- perform 350-write-footer
- close sales-trans sales-report
- goback.
- 150-write-headings.
- perform 200-get-date
- move top-heading to sales-record
- write sales-record
- move record-heading to sales-record
- write sales-record after advancing 1 line.
- 200-get-date.
- move function current-date to temp-date
- move temp-day to c-day
- move temp-month to c-month
- move temp-year to c-year.
- 250-write-record.
- perform varying i from 1 by 1 until i > 20
- move spaces to sales-record
- move i to salesperson-no-out
- move s-name(i) to salesperson-name-out
- move s-sales(i) to salesperson-sales
- add s-sales(i) to total-sales
- write sales-record.
- 300-fill-array.
- if salesperson-no <= 20
- move salesperson-name to s-name(salesperson-no)
- add amt-of-sales to s-sales(salesperson-no)
- end-if.
- 350-write-footer.
- move total-sales to total-sales-out
- move total-sales-heading to sales-record
- write sales-record after advancing 2 lines.
- end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement