Advertisement
Nick-O-Rama

assignment-15

Nov 30th, 2015
2,708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 2.05 KB | None | 0 0
  1.        identification division.
  2.        program-id. Program1.
  3.  
  4.        environment division.
  5.        input-output section.
  6.        select payroll-master assign to "C:\temp\pay-master.txt"
  7.            organization is line sequential.
  8.        select sorted-payroll-master assign to
  9.            "C:\temp\sorted-master.txt" organization is line sequential.
  10.        select sort-file assign to "C:\temp\sort-file.txt".
  11.        
  12.        configuration section.
  13.  
  14.        data division.
  15.        fd payroll-master.
  16.        01 master-rec.
  17.            05                      pic x(25).
  18.            05 m-territory          pic x(2).
  19.            05 m-office             pic x(2).
  20.            05                      pic x(6).
  21.            05 m-ssn                pic x(9).
  22.            05                      pic x(36).
  23.        
  24.        
  25.        fd sorted-payroll-master.
  26.        01 out-rec               pic x(80).
  27.        
  28.        sd sort-file.
  29.        01 sort-rec.
  30.            05                      pic x(25).
  31.            05 s-territory          pic x(2).
  32.            05 s-office             pic x(2).
  33.            05                      pic x(51).
  34.        
  35.        working-storage section.
  36.        01 eof                      pic x value 'N'.
  37.        procedure division.
  38.        100-main.
  39.            sort sort-file
  40.                on descending key s-territory
  41.                on descending key s-office
  42.                input procedure 200-select
  43.                giving sorted-payroll-master
  44.            goback.
  45.        200-select.
  46.            open input payroll-master
  47.            perform until eof = 'Y'
  48.                read payroll-master
  49.                    at end move 'Y' to eof
  50.                    not at end perform 300-choose
  51.                end-read
  52.            end-perform
  53.            close payroll-master.
  54.        300-choose.
  55.            if m-territory = spaces or m-office = spaces
  56.                or m-ssn = spaces
  57.                display master-rec
  58.            else
  59.                move master-rec to sort-rec
  60.                release sort-rec
  61.            end-if.
  62.        end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement