Advertisement
Nick-O-Rama

assignment-7

Sep 28th, 2015
1,335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 6.81 KB | None | 0 0
  1.        program-id. Program1 as "assignment_7-Program1".
  2.        environment division.
  3.        input-output section.
  4.        file-control. select payroll-master assign to
  5.                      "C:\temp\payroll-master.txt" organization is line
  6.                      sequential.                                        
  7.                      select payroll-report assign to
  8.                      "C:\temp\payroll-report.txt" organization is line
  9.                      sequential.
  10.        data division.
  11.        fd payroll-master.
  12.        01 payroll-file.
  13.            05 emp-no                               pic x(5).
  14.            05 emp-name                             pic x(20).
  15.            05                                      pic x(4).
  16.            05 annual-salary                        pic 9(6).
  17.            05                                      pic x(13).
  18.            05 union-dues                           pic 999V99.
  19.            05 insurance                            pic 999V99.
  20.            05                                      pic x(22).
  21.        fd payroll-report.
  22.        01 payroll-record.
  23.            05                                      pic x(3).
  24.            05 emp-no-out                           pic x(5).
  25.            05                                      pic x(2).
  26.            05 emp-name-out                         pic x(20).
  27.            05                                      pic x(2).
  28.            05 old-salary                           pic zzzzz9.
  29.            05                                      pic xx.
  30.            05 new-salary                           pic zzzzz9.
  31.            05                                      pic x(2).
  32.            05 old-dues                             pic zzz.99.
  33.            05                                      pic x.
  34.            05 new-dues                             pic zzzz.99.
  35.            05                                      pic x(2).
  36.            05 old-insurance                        pic zzz.99.
  37.            05                                      pic x.
  38.            05 new-insurance                        pic zzzz.99.
  39.            05                                      pic x(2).
  40.            
  41.        working-storage section.
  42.        01 page-heading.
  43.            05                              pic x(30) value spaces.
  44.            05 payroll-report-title         pic x(15) value
  45.                                                        "PAYROLL REPORT".
  46.            05                              pic x(21) value spaces.
  47.            05 the-date.
  48.                10 current-day                      pic xx/.
  49.                10 current-month                    pic xx/.
  50.                10 current-year                     pic xxxx.
  51.        01 temp-date.
  52.            05 temp-year                            pic xxxx.
  53.            05 temp-month                           pic xx.
  54.            05 temp-day                             pic xx.
  55.        01 field-titles-1.
  56.            05                                  pic x value spaces.
  57.            05                                  pic x(8) value "EMPLOYEE".  
  58.            05                                  pic x(9) value spaces.  
  59.            05                                  pic x(4) value "NAME".  
  60.            05                                  pic x(11) value spaces.
  61.            05                                  pic x(3) value "OLD".
  62.            05                                  pic x(5) value spaces.
  63.            05                                  pic x(3) value "NEW".
  64.            05                                  pic x(5) value spaces.
  65.            05                                  pic x(3) value "OLD".
  66.            05                                  pic x(5) value spaces.
  67.            05                                  pic x(3) value "NEW".
  68.            05                                  pic x(5) value spaces.
  69.            05                                  pic x(3) value "OLD".
  70.            05                                  pic x(5) value spaces.
  71.            05                                  pic x(3) value "NEW".
  72.            05                                  pic x(4) value spaces.
  73.        01 field-titles-2.
  74.            05                                  pic x(4) values spaces.
  75.            05                                  pic x(3) value "NO.".
  76.            05                                  pic x(25) value spaces.
  77.            05                                  pic x(6) value "SALARY".
  78.            05                                  pic x(2) value spaces.
  79.            05                                  pic x(6) value "SALARY".
  80.            05                                  pic x(3) value spaces.
  81.            05                                  pic x(4) value "DUES".
  82.            05                                  pic x(4) value spaces.
  83.            05                                  pic x(4) value "DUES".
  84.            05                                  pic x(3) value spaces.
  85.            05                                  pic x(6) value "INSUR.".
  86.            05                                  pic x(2) value spaces.
  87.            05                                  pic x(6) value "INSUR.".
  88.            05                                  pic x(2) value spaces.
  89.        01 end-flag                             pic x(3) value "YES".
  90.        procedure division.
  91.        100-main.
  92.            open input payroll-master
  93.                 output payroll-report
  94.            move function current-date to temp-date
  95.            perform 150-print-heading
  96.            perform until end-flag = "NO"
  97.                read payroll-master
  98.                    at end move "NO" to end-flag
  99.                    not at end
  100.                    perform 200-calculate-increases
  101.                    perform 250-write-record
  102.                end-read
  103.            end-perform
  104.            close payroll-master
  105.                  payroll-report
  106.            goback.
  107.            
  108.        150-print-heading.
  109.            move temp-year to current-year
  110.            move temp-month to current-month
  111.            move temp-day to current-day
  112.            move page-heading to payroll-record
  113.            write payroll-record
  114.            move field-titles-1 to payroll-record
  115.            write payroll-record after advancing 1 line
  116.            move field-titles-2 to payroll-record
  117.            write payroll-record.
  118.        200-calculate-increases.
  119.            move spaces to payroll-record
  120.            compute new-salary = (annual-salary * 0.07) + annual-salary
  121.            compute new-dues = (union-dues * 0.04) + union-dues
  122.            compute new-insurance = (insurance * 0.03) + insurance.
  123.        250-write-record.
  124.            move emp-no to emp-no-out
  125.            move emp-name to emp-name-out
  126.            move annual-salary to old-salary
  127.            move union-dues to old-dues
  128.            move insurance to old-insurance
  129.            write payroll-record after advancing 1 line.
  130.        end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement