Program :
IDENTIFICATION DIVISION.
PROGRAM-ID. FILE-SEQUENTIAL.
AUTHOR. SUCI-BELAPATI.
SECURITY. PROGRAM MEMASUKAN DATA ORGANISASI FILE SEQUENTIAL
MODE AKSES URUT.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT PEGAWAI ASSIGN TO DISK
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS STATUS-SALAH.
DATA DIVISION.
FILE SECTION.
FD PEGAWAI
LABEL RECORD IS STANDARD
VALUE OF FILE-ID IS “DFTRPEG.DAT”
DATA RECORD IS REC-PEG.
01 REC-PEG.
02 NAMA PIC X(10).
02 ALAMAT PIC X(20).
02 UMUR PIC 99.
WORKING-STORAGE SECTION.
77 STATUS-SALAH PIC XX.
01 SUDAH-BENAR PIC A.
88 BENAR VALUE ‘Y’, ‘y’.
88 BELUM VALUE ‘T’, ‘t’.
01 MASUKKAN-DATA-LAGI PIC A.
88 LAGI VALUE ‘Y’, ‘y’.
88 TIDAK VALUE ‘T’, ‘t’.
SCREEN SECTION.
01 HAPUS-LAYAR.
02 BLANK SCREEN.
01 LAYAR-DATA.
02 LINE 4 COLUMN 5 ‘NAMA :’.
02 COLUMN PLUS 1 PIC X(10) TO NAMA.
02 LINE 5 COLUMN 5 ‘ALAMAT :’.
02 COLUMN PLUS 1 PIC X(25) TO ALAMAT.
02 LINE 6 COLUMN 5 ‘UMUR :’.
02 COLUMN PLUS 1 PIC 99 TO UMUR.
PROCEDURE DIVISION.
BUKA-FILE.
OPEN EXTEND PEGAWAI.
MULAI.
MOVE SPACE TO SUDAH-BENAR
PERFORM INPUT-DATA UNTIL BENAR
PERFORM REKAM-DATA.
PERFORM ADA-LAGI.
IF LAGI GO TO MULAI.
SELESAI.
CLOSE PEGAWAI
STOP RUN.
INPUT-DATA.
DISPLAY HAPUS-LAYAR.
DISPLAY LAYAR-DATA.
ACCEPT LAYAR-DATA.
DISPLAY (8, 5) ‘SUDAH BENAR (Y/T) ? ‘
ACCEPT ( , ) SUDAH-BENAR.
REKAM-DATA.
MOVE ‘ ‘ TO STATUS-SALAH
WRITE REC-PEG
PERFORM TANYA-REKAM.
ADA-LAGI.
DISPLAY (12, 5) ‘ADA LAGI DATA (Y/T) ? ‘
ACCEPT ( , ) MASUKKAN-DATA-LAGI.
TANYA-REKAM.
IF STATUS-SALAH = ‘00'
DISPLAY (10, 5) ‘TIDAK TERJADI KESALAHAN ‘.
IF STATUS-SALAH = ‘10'
DISPLAY (10, 5) ‘EOF ‘.
IF STATUS-SALAH = ‘30'
DISPLAY (10, 5) ‘FILE NOT FOUND ‘.
IF STATUS-SALAH = ‘34'
DISPLAY (10, 5) ‘DISK SPACE FULL ‘.
IF STATUS-SALAH = ‘91'
DISPLAY (10, 5) ‘STRUKTUR FILE RUSAK ‘.