Advertisement
Nick-O-Rama

assignment-6

Sep 23rd, 2015
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 5.22 KB | None | 0 0
  1.        program-id. Program1 as "assignment_5.Program1".
  2.        
  3.        environment division.
  4.        input-output section.
  5.        file-control.
  6.                      select payroll-output assign to "C:\temp\payroll-out.txt" organization is line sequential.
  7.        data division.
  8.        fd payroll-output.
  9.        01 payroll-out-record.
  10.            05                                          pic x.
  11.            05 emp-no-out                               pic x(5).
  12.            05                                          pic x(4).
  13.            05 emp-name-out                             pic x(20).
  14.            05                                          pic x(5).
  15.            05 territory-no-out                         pic x(2).
  16.            05                                          pic x(8).
  17.            05 office-no-out                            pic x(2).
  18.            05                                          pic x(10).
  19.            05 annual-salary-out                        pic $$$,$99.
  20.            05                                          pic x(5).
  21.            05 ssn-no-out                               pic xxxbxxbxxxx.
  22.        working-storage section.
  23.        01 page-heading.
  24.            05                                          pic x(30) value spaces.
  25.            05 payroll-listing                          pic x(15) value "PAYROLL LISTING".
  26.            05                                          pic x(15) value spaces.
  27.            05 page-title                               pic x(5) value "PAGE ".
  28.            05 page-num                                 pic 99 value zero.
  29.            05                                          pic x(3) value spaces.
  30.            05 c-date.                            
  31.                10 current-day                          pic xx/.                      
  32.                10 current-month                        pic xx/.
  33.                10 current-year                         pic xxxx.
  34.        01 temp-date.
  35.            05 temp-year                                pic xxxx.
  36.            05 temp-month                               pic xx.
  37.            05 temp-day                                 pic xx.
  38.        01 field-titles.
  39.            05 emp-no-title                             pic x(8) value "EMP. NO.".
  40.            05                                          pic x(2) value spaces.
  41.            05 emp-name-title                           pic x(13) value "EMPLOYEE NAME".
  42.            05                                          pic x(9) value spaces.
  43.            05 territory-no-title                       pic x(8) value "TERR NO.".
  44.            05                                          pic x(2) value spaces.
  45.            05 office-no-title                          pic x(10) value "OFFICE NO.".
  46.            05                                          pic x(2) value spaces.
  47.            05 annual-salary-title                      pic x(13) value "ANNUAL SALARY".
  48.            05                                          pic x(2) value spaces.
  49.            05 ssn-title                                pic x(11) value "SOC SEC NO.".
  50.        01 end-flag                                     pic x value "Y".
  51.        01 line-num                                     pic 99 value zero.
  52.        screen section.
  53.        01 scr1.
  54.            05 blank screen
  55.               foreground-color 2.
  56.            05 line 1 column 5 value "EMP NO.: ".
  57.            05        column 20 to emp-no-out.
  58.            05 line 2 column 5 value "NAME: ".
  59.            05        column 20 to emp-name-out.
  60.            05 line 3 column 5 value "TERRITORY: ".
  61.            05        column 20 to territory-no-out.
  62.            05 line 4 column 5 value "OFFICE NO.: ".
  63.            05        column 20 to office-no-out.
  64.            05 line 5 column 5 value "ANN. SALARY: ".
  65.            05        column 20 to annual-salary-out.
  66.            05 line 6 column 5 value "SOCIAL SEC. NO.: ".
  67.            05        column 20 to ssn-no-out.
  68.            05 line 7 column 5 value "CONTINUE Y/N: ".
  69.            05        column 20 to end-flag.
  70.            
  71.        procedure division.
  72.        
  73.        100-main.
  74.        display scr1
  75.        open output payroll-output
  76.             move function current-date to temp-date
  77.             perform 150-print-heading
  78.             perform until end-flag = "N"
  79.                 accept scr1
  80.                 perform 200-write-record
  81.                 display scr1
  82.                
  83.            end-perform.
  84.            close payroll-output
  85.            goback.
  86.        150-print-heading.
  87.            add 1 to page-num
  88.            move temp-year to current-year
  89.            move temp-month to current-month
  90.            move temp-day to current-day
  91.            move page-heading to payroll-out-record
  92.            write payroll-out-record after advancing page.
  93.            move field-titles to payroll-out-record
  94.            write payroll-out-record after advancing 2 lines.
  95.            move zero to line-num
  96.            move spaces to payroll-out-record
  97.            write payroll-out-record after advancing 1 line.
  98.        200-write-record.
  99.            write payroll-out-record after advancing 1 line.
  100.            add 1 to line-num
  101.            if line-num > 10
  102.                perform 150-print-heading
  103.            end-if.
  104.                
  105.            
  106.        end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement