Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- identification division.
- program-id. Lab6.
- environment division.
- *
- input-output section.
- file-control.
- *
- select input-file
- assign to "../../data/lab6.dat"
- organization is line sequential.
- *
- select output-file
- assign to "../../data/lab6.out"
- organization is line sequential.
- data division.
- file section.
- *
- * Input and Output files
- *
- fd input-file
- data record is input-line
- record contains 28 characters.
- *
- 01 input-line.
- 05 il-employee-num pic 999.
- 05 il-employee-name pic x(15).
- 05 il-education-code pic x(1).
- 05 il-years-service pic 99.
- 05 il-salary pic 9(5)V99.
- *
- fd output-file
- data record is output-line
- record contains 79 characters.
- *
- 01 output-line pic x(79).
- *
- working-storage section.
- *
- 01 ws-eof-flag pic x value 'N'.
- *
- * Calculation Variables and Constants
- *
- 77 ws-lines-per-page pic 99 value 10.
- 77 ws-page-count pic 99 value 0.
- 77 ws-line-count pic 99 value 0.
- 77 ws-years-service-calc pic 99 value 0.
- 77 ws-increase-perc-calc pic 99v9 value 0.
- 77 ws-analyst-label pic x(7) value "ANALYST".
- 77 ws-analyst-threshold pic 99 value 15.
- 77 ws-analyst-perc pic 99v9 value 12.8.
- 77 ws-sen-prog-label pic x(8) value "SEN PROG".
- 77 ws-sen-prog-threshold pic 99v9 value 7.
- 77 ws-sen-prog-perc pic 99v9 value 9.3.
- 77 ws-prog-label pic x(4) value "PROG".
- 77 ws-prog-threshold pic 99 value 7.
- 77 ws-prog-perc pic 99v9 value 6.7.
- 77 ws-unclassified-perc pic 99v9 value 0.
- 77 ws-nong-prog-threshold pic 99v9 value 10.
- 77 ws-jr-prog-label pic x(7) value "JR PROG".
- 77 ws-nong-jr-prog-threshold pic 99 value 4.
- 77 ws-jr-prog-perc pic 99v9 value 3.2.
- *
- * Record Definitions
- *
- 01 ws-heading-line1.
- 05 filler pic x(1) value spaces.
- 05 ws-sys-date pic 9(6).
- 05 filler pic x(1) value spaces.
- 05 ws-sys-time pic 9(8).
- 05 filler pic x(1) value spaces.
- 05 filler pic x(22) value "Bobby Montminy, LAB 6".
- *
- 01 ws-heading-line2.
- 05 filler pic x(30).
- 05 filler pic x(22) value "EMPLOYEE SALARY REPORT".
- 05 filler pic x(14).
- 05 filler pic x(4) value "PAGE".
- 05 filler pic x(2).
- 05 ws-page-number pic 99.
- *
- 01 ws-heading-line3.
- 05 filler pic x(3) value "EMP".
- 05 filler pic x(2) value spaces.
- 05 filler pic x(3) value "EMP".
- 05 filler pic x(28) value spaces.
- 05 filler pic x(7) value "PRESENT".
- 05 filler pic x(2) value spaces.
- 05 filler pic x(8) value "INCREASE".
- 05 filler pic x(5) value spaces.
- 05 filler pic x(3) value "PAY".
- 05 filler pic x(11) value spaces.
- 05 filler pic x(3) value "NEW".
- *
- 01 ws-heading-line4.
- 05 filler pic x(3) value "NUM".
- 05 filler pic x(2) value spaces.
- 05 filler pic x(4) value "NAME".
- 05 filler pic x(10) value spaces.
- 05 filler pic x(5) value "YEARS".
- 05 filler pic x(1) value spaces.
- 05 filler pic x(8) value "POSITION".
- 05 filler pic x(4) value spaces.
- 05 filler pic x(6) value "SALARY".
- 05 filler pic x(5) value spaces.
- 05 filler pic x(1) value "%".
- 05 filler pic x(5) value spaces.
- 05 filler pic x(8) value "INCREASE".
- 05 filler pic x(7) value spaces.
- 05 filler pic x(6) value "SALARY".
- *
- 01 ws-detail-line.
- 05 ws-employee-num pic 999.
- 05 filler pic x(1) value spaces.
- 05 ws-employee-name pic x(15).
- 05 filler pic x(3) value spaces.
- 05 ws-years-service pic z9.
- 05 filler pic x(2) value spaces.
- 05 ws-position pic x(8).
- 05 filler pic x(2) value spaces.
- 05 ws-salary pic zz,zz9.99.
- 05 filler pic x(2) value spaces.
- 05 ws-increase-perc pic z9.9.
- 05 ws-perc-sign pic x(1) value "%".
- 05 filler pic x(4) value spaces.
- 05 ws-increase-amnt pic $$,$$9.99+.
- 05 filler pic x(2).
- 05 ws-new-salary pic $zzzzz,zz9.99.
- *
- 01 ws-total-line1.
- 05 filler pic x(15) value "EMPLOYEE CLASS:".
- 05 filler pic x(8) value spaces.
- 05 filler pic x(7) value "Analyst".
- 05 filler pic x(4) value spaces.
- 05 filler pic x(8) value "Sen Prog".
- 05 filler pic x(4) value spaces.
- 05 filler pic x(4) value "Prog".
- 05 filler pic x(4) value spaces.
- 05 filler pic x(7) value "Jr Prog".
- 05 filler pic x(2) value spaces.
- 05 filler pic x(12) value "Unclassified".
- *
- 01 ws-total-line2.
- 05 filler pic x(15) value "# ON THIS PAGE:".
- 05 filler pic x(14) value spaces.
- 05 ws-analyst-total pic 9 value 0.
- 05 filler pic x(11) value spaces.
- 05 ws-sen-prog-total pic 9 value 0.
- 05 filler pic x(7) value spaces.
- 05 ws-prog-total pic 9 value 0.
- 05 filler pic x(10) value spaces.
- 05 ws-jr-prog-total pic 9 value 0.
- 05 filler pic x(15) value spaces.
- 05 ws-unclassified-total pic 9 value 0.
- procedure division.
- 000-Main.
- *
- * Open files
- *
- open input input-file,
- output output-file.
- *
- accept ws-sys-date from date.
- accept ws-sys-time from time.
- *
- * Initial read of input file
- *
- read input-file
- at end
- move 'Y' to ws-eof-flag.
- write output-line from ws-heading-line1.
- *
- * Process each input record and read in next record
- *
- perform 100-process-pages
- until ws-eof-flag equals "y".
- *
- * Processed all records in perform loop
- * Handle output of totals and program completion
- *
- * Move totals to total line and write to output file
- * with blank line after total line
- *
- *
- * Close files and end program
- *
- close input-file,
- output-file.
- stop run.
- 100-process-pages.
- add 1 to ws-page-count.
- move spaces to output-line.
- *
- * Write the report heading with a blank line before heading
- * and blank line after heading
- *
- if (ws-page-count > 1) then
- write output-line
- after advancing page
- write output-line
- write output-line from ws-heading-line2
- write output-line from ws-heading-line3
- write output-line from ws-heading-line4
- move spaces to output-line
- write output-line
- else
- write output-line
- write output-line from ws-heading-line2
- write output-line from ws-heading-line3
- write output-line from ws-heading-line4
- move spaces to output-line
- write output-line
- end-if.
- *
- * process input and output results until
- * current page has been filled
- * OR EOF has been encountered
- *
- perform 200-process-records
- varying ws-line-count from 1 by 1
- until (ws-line-count > ws-lines-per-page
- OR ws-eof-flag = "y").
- perform 300-process-records.
- 200-process-records.
- *
- move il-employee-num to ws-employee-num.
- move il-employee-name to ws-employee-name.
- move il-years-service to ws-years-service.
- move il-salary to ws-salary.
- move ws-years-service to ws-years-service-calc.
- write output-line from ws-detail-line.
- *
- * Read next input record for the next iteration of perform loop
- *
- read input-file
- at end
- move 'y' to ws-eof-flag.
- 300-process-records.
- if il-education-code = "G" then
- if ws-years-service-calc > ws-analyst-threshold then
- move ws-analyst-label to ws-position
- move ws-analyst-perc to ws-increase-perc-calc
- end-if
- if ws-years-service-calc <= ws-analyst-threshold and
- ws-years-service-calc > ws-sen-prog-threshold then
- move ws-sen-prog-label to ws-position
- move ws-sen-prog-perc to ws-increase-perc-calc
- end-if
- if ws-years-service-calc <= ws-sen-prog-threshold and
- ws-years-service-calc > ws-prog-threshold then
- move ws-prog-label to ws-position
- move ws-prog-perc to ws-increase-perc-calc
- end-if
- if ws-years-service-calc <= ws-prog-threshold then
- move spaces to ws-position
- move ws-unclassified-perc to ws-increase-perc
- end-if
- else
- if ws-years-service-calc > ws-nong-prog-threshold then
- move ws-prog-label to ws-position
- move ws-prog-perc to ws-increase-perc-calc
- end-if
- if ws-years-service-calc <= ws-nong-prog-threshold and
- ws-years-service-calc > ws-nong-jr-prog-threshold then
- move ws-jr-prog-label to ws-position
- move ws-jr-prog-perc to ws-increase-perc-calc
- end-if
- if ws-years-service-calc < ws-nong-jr-prog-threshold then
- move spaces to ws-position
- move ws-unclassified-perc to ws-increase-perc-calc
- end-if
- end-if.
- end program Lab6.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement