title: How do I process a sequential file with two different types of records?
body: <p>For an assignment as part of a COBOL course, my input file is a sequential file called BRANCHTOT.SEQ with two types of records:</p>
  
  <p>The first is what I call a header record that states the total amount of records in the file (excluding the header record itself). This is only one record.</p>
  
  <p>If this were to be the only record in the file, I'd define it as follows:</p>
  
  <pre><code>01 header-record.
     03 record-count  PIC 9(6).
     03 FILLER        PIC X(13). 
  </code></pre>
  
  <p>The second type of records are the records I will have to read and process for the output. Its structure is as follows:</p>
  
  <pre><code>01 sales-record.
     03 branch-nr    PIC X(5).
     03 office-nr    PIC 9(2).
     03 count        PIC 9(5).
     03 sum          PIC 9(5)V99.
  </code></pre>
  
  <ol>
  <li>How do I define the BRANCHTOT.SEQ file in my FILE SECTION and WORKING-STORAGE SECTION? Do I use a redefine?</li>
  </ol>
  
  <p>I'm used to working with files with one type of record. </p>
  
  <ol start="2">
  <li>How do I read and process the sales-record type of records without the header-record getting in the way? </li>
  </ol>
  
  <p>The assignment is much more complex than I'm describing here, but
  for this part of the problem my program has to read and process the sales-record records and print the total amount of these records it has read, and compare that to the amount listed in the header-record. If the two don't match I need to have a statement in my output list to note this error. </p>
  
  <ol start="3">
  <li>How do I go about this?</li>
  </ol>