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 emp-data assign to "C:\temp\emp-data.txt"
- organization is line sequential.
- select print-file assign to "C:\temp\print-file.txt"
- organization is line sequential.
- configuration section.
- data division.
- file section.
- fd emp-data.
- 01 emp-in.
- 05 dept-in pic 99.
- 05 area-in pic 99.
- fd print-file.
- 01 out-rec.
- 05 filler pic x(9).
- 05 dept-title pic x(11).
- 05 dept-num pic 99.
- 05 filler pic x(11).
- 05 area-out occurs 20 times.
- 10 area-print pic zz9.
- 10 filler pic x(7).
- working-storage section.
- 01 top-heading.
- 05 pic x(43) value spaces.
- 05 pic x(47) value
- "TOTAL NO OF EMPLOYEES BY AREA WITHIN DEPARTMENT".
- 05 pic x(9) value spaces.
- 05 the-date.
- 10 the-day pic xx/.
- 10 the-month pic xx/.
- 10 the-year pic xxxx.
- 05 pic x(19) value spaces.
- 01 temp-date.
- 05 temp-year pic xxxx.
- 05 temp-month pic xx.
- 05 temp-day pic xx.
- 01 area-heading.
- 05 pic x(33) value spaces.
- 05 pic x(5) value "AREA1".
- 05 pic x(5) value spaces.
- 05 pic x(5) value "AREA2".
- 05 pic x(5) value spaces.
- 05 pic x(5) value "AREA3".
- 05 pic x(5) value spaces.
- 05 pic x(5) value "AREA4".
- 05 pic x(5) value spaces.
- 05 pic x(5) value "AREA5".
- 05 pic x(5) value spaces.
- 05 pic x(5) value "AREA6".
- 05 pic x(5) value spaces.
- 05 pic x(5) value "AREA7".
- 05 pic x(5) value spaces.
- 05 pic x(5) value "AREA8".
- 05 pic x(5) value spaces.
- 05 pic x(5) value "AREA9".
- 05 pic x(5) value spaces.
- 05 pic x(6) value "AREA10".
- 01 emp-table.
- 05 ws-dept occurs 20 times.
- 10 ws-area occurs 10 times.
- 15 emp-count pic 999 value zero.
- 01 eof pic x value "N".
- 01 x pic 99 value zero.
- 01 y pic 99 value zero.
- procedure division.
- 100-main.
- open input emp-data output print-file
- perform 150-write-headings
- perform until eof = "Y"
- read emp-data
- at end move "Y" to eof
- not at end
- if dept-in > 0 and area-in > 0
- add 1 to emp-count(dept-in, area-in)
- end-if
- end-perform
- perform 200-write-record
- close emp-data print-file
- goback.
- 150-write-headings.
- move spaces to out-rec
- move function current-date to temp-date
- move temp-day to the-day
- move temp-month to the-month
- move temp-year to the-year
- move top-heading to out-rec
- write out-rec
- move area-heading to out-rec
- write out-rec after advancing 1 line.
- 200-write-record.
- move spaces to out-rec
- move "DEPARTMENT-" to dept-title
- perform varying x from 1 by 1 until x > 20
- perform varying y from 1 by 1 until y > 10
- move x to dept-num
- move emp-count(x, y) to area-print(y)
- end-perform
- write out-rec after advancing 2 lines
- end-perform.
- end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement