       IDENTIFICATION DIVISION.
        PROGRAM-ID.oefening-12b.
        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.

        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.
        screen section.
        copy "lijst.txt".

       PROCEDURE DIVISION.
       hoofdprogramma.

       perform m-o-kopregels
       perform m-o-body
       perform m-o-eindregel
       Stop run
       .

        m-o-kopregels.
        open input cdbestand
        read cdbestand
        at end set EOF-cd to true
        end-read
        move c-cdrecord to o-cdrecord
        display g-lijst

        .

        m-o-body.
        perform v-c-cdrecord-m-o-regel
        until eof-cd
        .

        m-o-eindregel.
        close cdbestand
        .

       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


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