       identification division.
       program-id. Deel-4-Opgave-12a.
       author. Keppens Toon.

       environment division.
        configuration section.
         source-computer. PC.
         object-computer. PC.
       input-output section.
        file-control.
           select cdbestand
               assign to
               "E:\TI 2A\Back-end Programmeren\Oefeningen\Hoofdstuk 4\Oe
      -        "fening_1_Lijst_cdbestand.dat"
               organization sequential
               access sequential
               file status cd-status.
           select eurobestand
               assign to
               "E:\TI 2A\Back-end Programmeren\Oefeningen\Hoofdstuk 4\Oe
      -        "fening_1_Lijst_cd_euro_bestand.dat"
               organization sequential
               access sequential
               file status cd-euro-status.

       data division.
        file section.
          FD cdbestand.
          01 C-cdrecord.
               03 C-cd-titel pic x(20).
               03 C-cd-uitvoerder pic x(20).
               03 C-cd-genre pic x(15).
               03 C-cd-prijs pic 9(4).
          FD eurobestand.
          01 C-eurorecord.
               03 C-euro-titel pic x(20).
               03 C-euro-uitvoerder pic x(20).
               03 C-euro-genre pic x(15).
               03 C-euro-prijs pic 9999V99.

       working-storage section.
           01 cd-status pic xx.
               88 EOF-cd value "10".
           01 cd-euro-status pic xx.
               88 EOF-cd-euro value "10".
           01 I-c-cdrecord.
               03 I-c-cd-titel pic x(20).
               03 I-c-cd-uitvoerder pic x(20).
               03 I-c-cd-genre pic x(15).
               03 I-c-cd-prijs pic 9(4).
           01 I-c-eurorecord.
               03 I-c-euro-titel pic x(20).
               03 I-c-euro-uitvoerder pic x(20).
               03 I-c-euro-genre pic x(15).
               03 I-c-euro-prijs pic 9999V99.

       procedure division.
           main.

               perform b-prog
               perform body
               perform e-prog

               stop run
           .

           b-prog.
            open input cdbestand
            open output eurobestand
            read cdbestand at end continue
            end-read
           .

           body.
               perform v-c-cdrecord-m-cdeuro-record with test before
               until EOF-cd
           .

           e-prog.
               close cdbestand
               close eurobestand
           .

           v-c-cdrecord-m-cdeuro-record.
      *        compute I-c-euro-prijs = C-cd-prijs/40.3399
               divide 40.3399 into C-cd-prijs giving I-c-euro-prijs
               move C-cd-titel to I-c-euro-titel
               move C-cd-uitvoerder to I-c-euro-uitvoerder
               move C-cd-genre to I-c-euro-genre
               write C-eurorecord from I-c-eurorecord
               read cdbestand at end continue
               end-read
           .
