Nick-O-Rama

ass10-v

Oct 19th, 2015
559
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.        program-id. Program1.
  2.        
  3.        environment division.
  4.        input-output section.
  5.         select inputs assign to "C:\temp\sales-trans.txt"
  6.                organization is line sequential.
  7.         select outputs assign to "C:\temp\sales-report.txt"
  8.                organization is line sequential.
  9.        data division.
  10.        fd inputs.
  11.        01 sales-trans.
  12.            05 salesperson-no pic 99.
  13.            05 salesperson-name pic x(20).
  14.            05 amt-sale pic 999v99.
  15.        fd outputs.
  16.        01 sales-report.
  17.            05 pic x(13).
  18.            05 salesperson-no-out pic 99.
  19.            05 pic x(12).
  20.            05 salesperson-name-out pic x(20).
  21.            05 pic x(5).
  22.            05 amt-sale-out pic $zz,zzz.99.
  23.            05 pic x(14).
  24.        working-storage section.
  25.        01 Date-In.
  26.            05 year-In pic 9999.
  27.            05 month-In pic 99.
  28.            05 day-In pic 99.
  29.        01 MyDate.
  30.            05 currentDay pic 99.
  31.            05 pic x value '/'.
  32.            05 currentMonth pic 99.
  33.            05 pic x value '/'.
  34.            05 currentYear pic 9999.
  35.        01 header1.
  36.            05 pic x(20) value spaces.
  37.            05 pic x(32) value "TOTAL SALES FOR EACH SALESPERSON".
  38.            05 pic x(4) value spaces.
  39.            05 date-out pic 99/99/9999.
  40.        01 header2.
  41.            05 pic x(8) value spaces.
  42.            05 pic x(15) value "SALESPERSON NO.".
  43.            05 pic x(4) value spaces.
  44.            05 pic x(16) value "SALESPERSON NAME".
  45.            05 pic x(9) value spaces.
  46.            05 pic x(11) value "TOTAL SALES".
  47.        01 more-records pic xxx value 'yes'.
  48.        01 salesperson.
  49.            05 s-name occurs 20 times pic x(20).
  50.            05 a-sale occurs 20 times pic 9999999.
  51.        01 current-s-num pic 99.
  52.        01 x pic 99.
  53.        01 footer1.
  54.            05 pic x(42).
  55.            05 pic x(19) value "TOTAL COMPANY SALES".
  56.            05 pic x(3) value spaces.
  57.            05 total-sale pic $$,$$$,$$$.99.
  58.        01 total-sale-in pic 999999v99.
  59.        procedure division.
  60.        100-main.
  61.            open    input inputs
  62.                    output outputs
  63.            perform 200-date
  64.            perform until more-records = 'no'
  65.                read inputs
  66.                    at end
  67.                        move 'no' to more-records
  68.                    not at end
  69.                        perform 300-fillArray
  70.                end-read
  71.            end-perform
  72.            perform 400-header
  73.            perform 500-print
  74.            close inputs
  75.                  outputs
  76.            stop run.
  77.        200-date.
  78.            move function current-date to Date-In
  79.            move year-In to currentYear
  80.            move month-In to currentMonth
  81.            move day-In to currentDay
  82.            move MyDate to Date-Out.
  83.        300-fillArray.
  84.            move salesperson-name to s-name(salesperson-no)
  85.            add amt-sale to a-sale(salesperson-no).
  86.        400-header.
  87.            move header1 to sales-report
  88.            write sales-report
  89.            move spaces to sales-report
  90.            move header2 to sales-report
  91.            write sales-report
  92.                after advancing 2 lines.
  93.        500-print.
  94.            perform varying x from  1 by 1 until x > 20
  95.                move spaces to sales-report
  96.                move x to salesperson-no-out
  97.                move s-name(x) to salesperson-name-out
  98.                move a-sale(x) to amt-sale-out
  99.                write sales-report
  100.                add a-sale(x) to total-sale-in
  101.            end-perform
  102.            move total-sale-in to total-sale
  103.            move space to sales-report
  104.            move footer1 to sales-report
  105.            write sales-report
  106.                after advancing 2 lines.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×