       IDENTIFICATION DIVISION.
       program-id. oefening-13C.
       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:\Documents and Settings\Stompie\Mijn documenten\School
      -        "\2Info\Cobol\Oef\Oef13\product.dat"
               organization sequential
               access sequential
               file status product-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.

       WORKING-STORAGE SECTION.
           01 scherm-1.
               03 lijn-11 pic x(15) value "HOGESCHOOL Gent".
               03 lijn-12 pic x(12) value "Bart Coppens".
               03 lijn-13 pic x(11) value "Opgave 13C".
               03 lijn-14 pic x(40) value "BEPALEN ABSOLUTE BEWEGINGSHOE
      -        "VEELHEID".
               03 lijn-15 pic x(15) value "Productnummer".
               03 lijn-16 pic x(20) value "Bewegingshoeveelheid".
               03 lijn-17 pic x(22) value "Druk op een toets...".

           01 product-status pic xx.
               88 eof-product-status value "10".
           01 o-prodgeg.
               03 o-prodnummer pic x(6).
               03 o-prodhoev pic 999.
               03 o-vorigprodnr pic x(6).
           01 datum.
               03 jj pic 99.
               03 mm pic 99.
               03 dd pic 99.
           01 datume.
               03 dde pic 99.
               03 slash pic x value "/".
               03 mme pic 99.
               03 slash pic x value "/".
               03 jje pic 9999.
           01 toets pic x.
           01 a pic 9999.
           01 b pic 9999.

       PROCEDURE DIVISION.

           perform m-o-titels
           perform m-o-body
           perform e-prog
           stop run
           .


           m-o-titels.
               open input productbestand
               read productbestand at end continue
               end-read
               display spaces upon crt
               display lijn-11 at 0202
               display lijn-12 at 2402
               display lijn-13 at 2470
               display lijn-14 at 0720
               display lijn-15 at 0915
               display lijn-16 at 0950
               display lijn-17 at 2205
               accept datum from date
               move jj to jje
               move mm to mme
               move dd to dde
               add 2000 to jje
               display datume at 0270
               move 1119 to a
               move 1158 to b.

           m-o-body.
               perform v-p-groep-m-o-regel with test before until
               eof-product-status
               .

           e-prog.
               close productbestand
               accept toets at 2240.

           v-p-groep-m-o-regel.

               perform b-groep
               perform m-o-body2
               perform e-groep.

           b-groep.
               move 0 to o-prodhoev
               move p-prodnummer to o-vorigprodnr
               move p-prodnummer to o-prodnummer.

           m-o-body2.
               perform v-p-record with test before until
               ((p-prodnummer not= o-vorigprodnr) or
               eof-product-status).

           e-groep.
               display o-prodnummer at a
               display o-prodhoev at b
               add 100 to a
               add 100 to b.

           v-p-record.
               compute o-prodhoev = o-prodhoev + p-prodhoev
               read productbestand at end continue
               end-read.
