Guest User

Untitled

a guest
Oct 21st, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 4.31 KB | None | 0 0
  1. Oplossing opgave 7.
  2.  
  3. Opgave 7A.
  4.  
  5.  IDENTIFICATION DIVISION.
  6.      PROGRAM-ID. oef7a_1011.
  7.        environment division.
  8.        input-output section.
  9.        file-control.
  10.          select artiesten assign "artiesten.dat"
  11.            organization is indexed
  12.            access is random
  13.            record key is boekingscode.
  14.          select wijzigingen assign "wijziging.txt".
  15.        data division.
  16.        file section.
  17.        fd wijzigingen.
  18.        01 wijzig-rec.
  19.           02 wijzig-code        pic x(10).
  20.           02 wijzig-prijs       pic s9(5)v99 sign leading separate.
  21.        fd artiesten.
  22.        copy copy-artiesten-rec.  
  23.        working-storage section.
  24.        01 prijs-ed pic z(7).zz.
  25.        01 toets pic x.
  26.          88 niet-gevonden  value high-values.
  27.        procedure division.
  28.        pgm.
  29.          open input wijzigingen artiesten
  30.          read wijzigingen
  31.            at end display "geen wijzigingen"
  32.                   set einde-bestand to true
  33.          end-read
  34.          perform until einde-bestand
  35.            move wijzig-code to boekingscode
  36.            move low-values to toets
  37.            read artiesten
  38.              invalid key
  39.                move high-values to toets
  40.                display "boekingscode " wijzig-code " bestaat niet"
  41.             end-read
  42.             if not niet-gevonden
  43.                move boekingsprijs to prijs-ed
  44.                add wijzig-prijs to boekingsprijs
  45.                rewrite artiesten-rec
  46.                  invalid key display "wijziging niet doorgevoerd"
  47.                  not invalid key
  48.                    display "boekingsprijs " wijzig-code " gewijzigd"
  49.                    display "oud: " prijs-ed
  50.                    move boekingsprijs to prijs-ed
  51.                    display "nieuw: " prijs-ed
  52.                end-rewrite
  53.             end-if
  54.             read wijzigingen
  55.              at end display "einde wijzigingen"
  56.                     set einde-bestand to true
  57.            end-read
  58.          end-perform
  59.          accept toets.
  60.        einde.  
  61.          close wijzigingen artiesten
  62.          stop run.  
  63. 01 artiesten-rec.
  64.          88 einde-bestand       value high-values.
  65.           02 boekingscode.
  66.              04 boek-eerstechar pic x(1).
  67.              04 boek-rest       pic x(9).
  68.           02 naam               pic x(20).
  69.           02 boekingsprijs      pic 9(5)v99.
  70.           02 genre              pic x(10).
  71.           02 land               pic x(3).    
  72.  
  73. Opgave 7B.
  74.  
  75.  IDENTIFICATION DIVISION.
  76.  PROGRAM-ID. oef7b_1011.
  77.        environment division.
  78.        configuration section.
  79.        special-names.
  80.          decimal-point is comma
  81.          currency sign is "E".
  82.        input-output section.
  83.        file-control.
  84.          select artiesten assign "artiesten.dat"
  85.            organization is indexed
  86.            access is sequential
  87.            record key is boekingscode.
  88.          select uitvoer assign "uitvoer-oef7.txt"
  89.            organization is line sequential.
  90.        data division.
  91.        file section.
  92.        fd uitvoer.
  93.        01 u-rec.
  94.           02                    pic x(10).
  95.           02 u-titel.
  96.              03 u-code          pic x(10)b.
  97.              03 u-artiest       pic x(20)b.
  98.              03 u-land          pic x(3)b.
  99.              03 u-prijs         pic EEEE.E(3),99.
  100.        fd artiesten.
  101.        copy copy-artiesten-rec.  
  102.        working-storage section.
  103.        01 toets pic x.
  104.        procedure division.
  105.        pgm.
  106.          open input artiesten output uitvoer
  107.          read artiesten
  108.            at end display "geen artiesten"
  109.                   set einde-bestand to true
  110.            not at end
  111.              move "overzicht boekingsprijs per artiest in 2011"
  112.                to u-titel
  113.              write u-rec
  114.              move all "_" to u-titel
  115.              write u-rec
  116.              move spaces to u-titel
  117.              write u-rec
  118.          end-read
  119.          perform until einde-bestand
  120.            move boekingscode to u-code
  121.            move naam to u-artiest
  122.            move land to u-land
  123.            move boekingsprijs to u-prijs
  124.            write u-rec
  125.            read artiesten
  126.              at end display "einde artiestenbestand"
  127.                     set einde-bestand to true
  128.            end-read
  129.          end-perform
  130.          accept toets
  131.        einde.  
  132.          close artiesten
  133.          stop run.
Add Comment
Please, Sign In to add comment