Advertisement
Nick-O-Rama

assignment-3

Sep 10th, 2015
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 2.25 KB | None | 0 0
  1.        identification division.
  2.        program-id. assignment-2.
  3.  
  4.        environment division.
  5.        input-output section.
  6.        file-control.
  7.        select account-trans assign to
  8.        "C:\Users\Compsci\Desktop\files\account-trans.txt".              
  9.                      select account-master assign to
  10.        "C:\Users\Compsci\Desktop\files\account-master.txt".            
  11.        configuration section.
  12.        data division.
  13.        fd account-trans.
  14.        01 input-record.
  15.            05 acct-no-in                           pic x(5).
  16.            05 cust-name-in                         pic x(20).
  17.            05 amt1-in                              pic 999V99.
  18.            05 amt2-in                              pic 999V99.
  19.            05 discount-amt-in                      pic 999V99.
  20.        fd account-master.
  21.        01 output-record.
  22.            05 acct-no-out                          pic x(5).
  23.            05 cust-name-out                        pic x(20).
  24.            05 total-out                            pic 9999V99.
  25.            05 amt-due-out                          pic 9999V99.
  26.            05 filler                               pic x(3).
  27.        working-storage section.
  28.        01 end-flag                                 pic x(3) value "YES".
  29.        procedure division.
  30.        100-main.
  31.            display "test"
  32.            open input account-trans
  33.                 output account-master
  34.            perform until end-flag = "NO"
  35.                read account-trans
  36.                    at end
  37.                        move "NO" to end-flag
  38.                    not at end
  39.                        perform 150-calculation
  40.                end-read
  41.            end-perform.
  42.                close account-trans
  43.                      account-master
  44.            goback.
  45.        150-calculation.
  46.            display acct-no-in
  47.            move spaces to output-record
  48.            move acct-no-in to acct-no-out
  49.            move cust-name-in to cust-name-out
  50.            add amt1-in to amt2-in giving total-out
  51.            subtract discount-amt-in from total-out giving
  52.            amt-due-out                                                  
  53.            
  54.            write output-record after advancing 1 line.
  55.            
  56.        end program assignment-2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement