Bentuk 1:
PERFORM nama-paragraph-1 { THRU /
THROUGH } nama-paragraph-2
{ nama-data / integer } TIMES
{ nama-data / integer } TIMES
contoh :
IDENTIFICATION DIVISION.
PROGRAM-ID. ulang1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 nomor-urut PIC 9.
PROCEDURE DIVISION.
Ulang-proses.
PERFORM Cetak-tampilan 5 TIMES.
STOP RUN.
Cetak-tampilan.
ADD 1 to nomor-urut.
DISPLAY ‘ Tampilan ke = ‘, nomor-urut.
PROGRAM-ID. ulang1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 nomor-urut PIC 9.
PROCEDURE DIVISION.
Ulang-proses.
PERFORM Cetak-tampilan 5 TIMES.
STOP RUN.
Cetak-tampilan.
ADD 1 to nomor-urut.
DISPLAY ‘ Tampilan ke = ‘, nomor-urut.
Hasil keluaran :
Tampilan ke = 1
Tampilan ke = 2
Tampilan ke = 3
Tampilan ke = 4
Tampilan ke = 5
Tampilan ke = 2
Tampilan ke = 3
Tampilan ke = 4
Tampilan ke = 5
Bentuk 2:
PERFORM nama-paragraph-1 { THRU /
THROUGH } nama-paragraph-2
UNTIL kondisi
UNTIL kondisi
Contoh:
IDENTIFICATION DIVISION.
PROGRAM-ID. PERFORM1.
AUTHOR. AYU.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MULAI.
PERFORM BINTANG.
DISPLAY ‘ C O B O L’.
PERFORM BINTANG.
STOP RUN.
BINTANG.
DISPLAY ‘********************’.
PROGRAM-ID. PERFORM1.
AUTHOR. AYU.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MULAI.
PERFORM BINTANG.
DISPLAY ‘ C O B O L’.
PERFORM BINTANG.
STOP RUN.
BINTANG.
DISPLAY ‘********************’.
Hasil keluaran :
********************
C O B O L
********************
C O B O L
********************
Bentuk 3:
PERFORM nama-paragraph-1 { THRU /
THROUGH } nama-paragraph-2
VARYING nama-data-1
FROM {nama-data-2 / integer-1} BY {nama-data-3 / integer-2}
UNTIL kondisi-1
[ AFTER nama-data-4
FROM {nama-data-5 / integer-3} BY {nama-data-6 / integer-4 }
UNTIL kondisi-2 ]
[ AFTER nama-data-7
FROM {nama-data-8 / integer-5} BY {nama-data-9 / integer-6 }
UNTIL kondisi-3
VARYING nama-data-1
FROM {nama-data-2 / integer-1} BY {nama-data-3 / integer-2}
UNTIL kondisi-1
[ AFTER nama-data-4
FROM {nama-data-5 / integer-3} BY {nama-data-6 / integer-4 }
UNTIL kondisi-2 ]
[ AFTER nama-data-7
FROM {nama-data-8 / integer-5} BY {nama-data-9 / integer-6 }
UNTIL kondisi-3
Tidak ada komentar:
Posting Komentar