       IDENTIFICATION DIVISION.
       program-id. oefening-13B.
       author. Levy De Vos.
       date-written. 03-november-04.

       environment division.
        configuration section.
         source-computer. pc.
         object-computer. pc.
       input-output section.
       file-control.
           select productbestand
               assign to
               "D:\School\Back-End programmeren\product.dat"
               organization sequential
               access sequential
               file status product-status.
           select product100
               assign to
               "D:\School\Back-End programmeren\product100.dat"
               organization sequential
               access sequential
               file status prod100-status.

       DATA DIVISION.
        file section.
           fd productbestand.
           01 p-productrecord.
               03 p-prodnummer pic x(6).
               03 p-prodaard pic x.
               03 p-prodhoev pic 999.

           fd product100.
           01 u-prod100record.
               03 u-prodnummer pic x(6).
               03 u-prodaard pic x.
               03 u-prodhoev pic 999.

       WORKING-STORAGE SECTION.
           01 product-status pic xx.
               88 eof-product-status value "10".
           01 prod100-status pic xx.
               88 eof-prod100-status value "10".

       PROCEDURE DIVISION.
       perform b-prog
       perform body
       perform e-prog
       stop run
           .

       b-prog.
               open input productbestand
               open output product100
               read productbestand at end continue
               end-read.
       body.
               perform v-p-productrecord with test before until
               eof-product-status.
       e-prog.
               close productbestand
               close product100.
       v-p-productrecord.
               if (p-prodhoev <= 100)
                   then perform v-p-rec
               end-if
               if (p-prodhoev > 100)
                   then perform v-p-rec-m-o-prodrecord100
               end-if.
       v-p-rec.
               read productbestand at end continue
               end-read.
       v-p-rec-m-o-prodrecord100.
               write u-prod100record from p-productrecord
               read productbestand at end continue
               end-read.
               exit program.

