       IDENTIFICATION DIVISION.
       program-id. oefening-13B.
       author. coppens bart.
       date-written. 05-november-2003.

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

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

           fd product100.
           01 a-prod100record.
               03 a-prodnummer pic x(6).
               03 a-prodaard pic x.
               03 a-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".
           01 i-prodgeg.
               03 i-c-prodnummer pic x(6).
               03 i-c-prodaard pic x.
               03 i-c-prodhoev pic 999.
           01 i-prod100geg.
               03 i-c-prod100nr pic x(6).
               03 i-c-prod100aard pic x.
               03 i-c-prod100hoev pic 999.
           01 toets pic x.
           01 a pic 9999.
           01 b pic 9999.

       SCREEN SECTION.
       COPY "C:\OEF13a.ss".

       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 (c-prodhoev <= 100)
                   then perform v-p-rec
               end-if
               if (c-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.
               move i-prodgeg to i-prod100geg
               write a-prod100record from a-productrecord
               read productbestand at end continue
               end-read.
