       IDENTIFICATION DIVISION.
       PROGRAM-ID. OEFENING12-A.
       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 CDBESTAND
               ASSIGN TO
               "D:\School\Back-End programmeren\cds.dat"
               organization sequential
               access sequential
               file status cd-status.

       DATA DIVISION.
        FILE SECTION.
           FD CDbestand.
           01 C-CDrecord.
               03 c-nummer PIC x(10).
               03 c-titel pic x(10).
               03 c-uitvoerder pic x(20).
               03 c-aantal pic 99.
               03 c-genre pic x(15).
               03 c-prijs pic 9(4).
               03 c-releasedatum pic 99/99/99.

        working-storage section.
           01 scherm-1.
               03 lijn-11 pic x(15) value "HOGESCHOOL Gent".
               03 lijn-12 pic x(12) value "Levy De Vos".
               03 lijn-13 pic x(11) value "Opgave 12A".
               03 lijn-14 pic x(20) value "TOEVOEGEN CD-RECORDS".
               03 lijn-15 pic x(7) value "Nummer:".
               03 lijn-16 pic x(6) value "Titel:".
               03 lijn-17 pic x(11) value "Uitvoerder:".
               03 lijn-18 pic x(7) value "Aantal:".
               03 lijn-19 pic x(6) value "Genre:".
               03 lijn-110 pic x(6) value "Prijs:".
               03 lijn-111 pic x(15) value "Releasedatum:".
               03 lijn-112 pic x(40) value "Wil je nog een record (CD) t
      -        "oevoegen?".

           01 CD-STATUS PIC XX.
               88 eof-cdstatus value "10".
           01 i-cdgeg.
               03 i-c-nummer pic x(10).
               03 i-c-titel pic x(10).
               03 i-c-uitvoerder pic x(20).
               03 i-c-aantal pic 99.
               03 i-c-genre pic x(15).
               03 i-c-prijs pic 9(4).
               03 i-c-releasedatum pic 99/99/99.
           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.
       hoofdprogramma.
       perform openbestand
       perform body with test before until verderstop
       perform einde
       stop run
               .
       openbestand.
               open extend cdbestand.

       body.
               perform vrecord.

       einde.
               close cdbestand.


       vrecord.
               initialize i-c-nummer
               initialize i-c-titel
               initialize i-c-uitvoerder
               initialize i-c-aantal
               initialize i-c-genre
               initialize i-c-prijs
               initialize i-c-releasedatum
               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 1225
               display lijn-19 at 1325
               display lijn-110 at 1425
               display lijn-111 at 1525
               display lijn-112 at 1924

               accept datum from date
               move jj to jje
               move dd to dde
               move mm to mme
               add 2000 to jje
               display datume at 0270
               accept i-c-nummer at 0940
               accept i-c-titel at 1040
               accept i-c-uitvoerder at 1140
               accept i-c-aantal at 1240
               accept i-c-genre at 1340
               accept i-c-prijs at 1440
               accept i-c-releasedatum at 1540
               write c-cdrecord from i-cdgeg
               accept verder at 1962
               perform with test before until verdergoed
                   display "Foutieve keuze" at 2135
                       accept verder at 1962
               end-perform
                   display "              " at 2135.
               exit program.
