       IDENTIFICATION DIVISION.
       program-id. oefening-13.
       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 13".
               03 lijn-14 pic x(22) value "MAKEN PRODUCTBESTAND".
               03 lijn-15 pic x(7) value "Nummer:".
               03 lijn-16 pic x(6) value "Aard:".
               03 lijn-17 pic x(13) value "Hoeveelheid:".
               03 lijn-18 pic x(40) value "Wil je nog een record toevoeg
      -        "en?".

           01 product-status pic xx.
               88 eof-product-status value "10".
           01 i-prodgeg.
               03 i-p-prodnummer pic x(6).
               03 i-p-prodaard pic x.
                   88 prodaardgoed values "+", "-".
               03 i-p-prodhoev pic 999.
           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 verder pic x.
               88 verdergoed values "J", "j", "N", "n".
               88 verderstop values "n", "N".

       PROCEDURE DIVISION.

           perform bprog
           perform body with test before until verderstop
           perform eprog
           stop run
           .


           bprog.
               open extend productbestand.


           body.
               perform vrecord.

           eprog.
               close productbestand.


               vrecord.
                   initialize i-p-prodnummer
                   initialize i-p-prodaard
                   initialize i-p-prodhoev
                   initialize verder
                   display spaces upon crt
                   display lijn-11 at 0202
                   display lijn-12 at 2402
                   display lijn-13 at 2470
                   display lijn-14 at 0525
                   display lijn-15 at 0925
                   display lijn-16 at 1025
                   display lijn-17 at 1125
                   display lijn-18 at 1905
                   accept datum from date
                   move jj to jje
                   move mm to mme
                   move dd to dde
                   add 2000 to jje
                   display datume at 0270
                   accept i-p-prodnummer at 0945
                   accept i-p-prodaard at 1045
                       perform with test before until prodaardgoed
                           display "foute keuze" at 1055
                           accept i-p-prodaard at 1045
                       end-perform
                   display "           " at 1055
                   accept i-p-prodhoev at 1145
                   write p-productrecord from i-prodgeg
                   accept verder at 1945
                       perform with test before until verdergoed
                           display "foute keuze" at 2035
                           accept verder at 1945
                       end-perform
                   display "           " at 2035.
