       IDENTIFICATION DIVISION.
        PROGRAM-ID.oefening-12c.
        AUTHOR.YANNIS-DE-WOLF.
        DATE-WRITTEN.ERGENS-IN-OKTOBER.

       ENVIRONMENT DIVISION.
        CONFIGURATION SECTION.
        SOURCE-COMPUTER.PC.
        OBJECT-COMPUTER.PC.

        Input-output section.
           file-control.
               select cdbestand
               assign to "toeta.dat"
               organization sequential
               access sequential
               file status cd-status.
       DATA DIVISION.
        file section.
           FD cdbestand.
           01 c-cdrecord.
               03 c-nummer pic x(5).
               03 c-titel pic x(20).
               03 c-uitvoerder pic x(20).
               03 c-aantal pic 99.
               03 c-genre pic x(15).
               03 c-prijs pic 9(6).
               03 c-releasedatum pic 99/99/99.

        WORKING-STORAGE SECTION.
        01 teller pic 99 value 12.
        01 rijteller pic 99 value 00.
        77 cd-status pic xx.
           88 eof-cd value '10'.
        01 o-cdrecord.
           02 o-nummer pic x(5).
           02 o-titel pic x(20).
           02 o-uitvoerder pic x(20).
           02 o-aantal pic 99.
           02 o-genre pic x(15).
           02 o-prijs pic 9(6).
           02 o-releasedatum pic 99/99/99.

        01 verder pic x.
        screen section.
        copy "lijst.txt".

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

        b-prog.
            open input cdbestand
            read cdbestand
            at end set EOF-cd to true
            end-read
            move c-cdrecord to o-cdrecord
           .

        groep-body.
            perform v-c-cdgroep-v-toets-m-o-scherm
            until eof-cd

           .

        v-c-cdgroep-v-toets-m-o-scherm.
           perform m-o-kopregel
           perform m-o-body
           perform m-o-eindregel
           .

       e-prog.
           close cdbestand
           .
       m-o-kopregel.
       display g-lijst
       move 01 to rijteller
       .

       m-o-body.
       perform v-c-cdrecord-m-o-regel
       until eof-cd or rijteller >= 10
       .

       m-o-eindregel.
       if rijteller >= 10
           then display "Toon vervolg..." at 5008
           else display "Klik om te eindigen" at 5008
       end-if
       accept verder at 5040
       if rijteller>= 10
           then display all spaces upon crt
       end-if
       move 12 to teller
       .

       v-c-cdrecord-m-o-regel.
         move C-titel to O-titel
         move C-uitvoerder to O-uitvoerder
         move C-prijs to O-prijs
         display O-titel at line teller col 11
         display O-uitvoerder at line teller col 36
         display O-prijs at line teller col 63
         add 1 to teller
         add 1 to rijteller

         read cdbestand
           at end set eof-cd to true
         end-read
        .
