alvinfnaldi

latih10

Nov 3rd, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 1.99 KB | None | 0 0
  1.        IDENTIFICATION DIVISION.
  2.        PROGRAM-ID. dimensi3.
  3.        ENVIRONMENT DIVISION.
  4.        DATA DIVISION.
  5.  
  6.        WORKING-STORAGE SECTION.
  7.        01 ws-subscript.
  8.            02 subscript-cabang PIC 9.
  9.            02 subscript-bulan PIC 9.
  10.            02 cabang OCCURS 3 TIMES.
  11.               03 bulan OCCURS 3 TIMES.
  12.                  04 jumlah-unit-terjual PIC 99.
  13.        77 total-penjualan-cabang PIC 99 VALUE 0.
  14.  
  15.        PROCEDURE DIVISION.
  16.        program-utama.
  17.            PERFORM entry-tabel.
  18.            PERFORM tampilkan-tabel.
  19.            STOP RUN.
  20.            
  21.        isi-data-tabel.
  22.            DISPLAY 'Cabang ', subscript-cabang,
  23.                    ' Bulan ', subscript-bulan, ' : '.
  24.            ACCEPT  ,  jumlah-unit-terjual
  25.                   (subscript-cabang, subscript-bulan).
  26.            DISPLAY SPACE.
  27.            
  28.        entry-tabel.
  29.            DISPLAY 'Pemasukan data ke dalam tabel dimensi tiga: '.
  30.            PERFORM isi-data-tabel
  31.                   VARYING subscript-cabang FROM 1 BY 1
  32.                   UNTIL subscript-cabang > 3
  33.                         AFTER subscript-bulan FROM 1 BY 1
  34.                         UNTIL subscript-bulan > 3.
  35.  
  36.        display-data-tabel.
  37.            DISPLAY  ,  'Cabang ', subscript-cabang,
  38.                ' Bulan ', subscript-bulan, ' : ',
  39.                jumlah-unit-terjual (subscript-cabang, subscript-bulan).
  40.            DISPLAY SPACE.
  41.            ADD jumlah-unit-terjual (subscript-cabang, subscript-bulan)
  42.                TO total-penjualan-cabang.
  43.            IF (subscript-bulan = 3)
  44.                 DISPLAY '*** Total penjualan per cabang = ',
  45.                 total-penjualan-cabang.      
  46.        
  47.        tampilkan-tabel.
  48.            DISPLAY 'Menampilkan isi tabel berdimensi tiga : '.
  49.            PERFORM display-data-tabel
  50.                   VARYING subscript-cabang FROM 1 BY 1
  51.                   UNTIL subscript-cabang > 3
  52.                         AFTER subscript-bulan FROM 1 BY 1
  53.                         UNTIL subscript-bulan > 3.
Add Comment
Please, Sign In to add comment