Advertisement
Guest User

Untitled

a guest
Sep 12th, 2018
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 1.26 KB | None | 0 0
  1.        identification division.
  2.        program-id.       lab01c.
  3.        
  4.        
  5.        
  6.        
  7.        
  8.        
  9.        
  10.        environment division.
  11.        input-output section.
  12.        file-control.
  13.            select infile assign to "lab1c-in.dat"
  14.                organization is line sequential.
  15.        
  16.        
  17.        
  18.        data division.
  19.        file section.
  20.        fd infile.
  21.        
  22.        working-storage section.
  23.        01  eof                 pic x value "n".
  24.        01  num                 pic 9(4).
  25.        
  26.        
  27.        
  28.        
  29.        
  30.        procedure division.
  31.        000-main.
  32.            perform 100-initialize
  33.            
  34.            perform until eof = "y"
  35.                read infile
  36.                  at end
  37.                    move "y" to eof
  38.                  not at end
  39.                    perform 500-process
  40.                end-read
  41.            end-perform
  42.            
  43.            display "the file contained " num " lines of data"
  44.            
  45.            perform 999-finalize
  46.            
  47.            stop run.
  48.            
  49.            
  50.        
  51.  
  52.        100-initialize.
  53.           open input infile.
  54.        
  55.  
  56.  
  57.  
  58.        500-process.
  59.           Add 1 to num.
  60.  
  61.  
  62.  
  63.        999-finalize.
  64.           close infile.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement