Senin, 14 Desember 2009

PROGRAM COBOL FILE RELATIF

PROGRAM COBOL FILE RELATIF


       IDENTIFICATION DIVISION.
       PROGRAM-ID. FILE-RELATIF.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES.
       DECIMAL-POINT IS COMMA.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
       SELECT MHS ASSIGN TO DISK
       ORGANIZATION IS RELATIVE
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS NO-REL
       FILE STATUS IS STATUS-SALAH.
       DATA DIVISION.
       FILE SECTION.
       FD MHS
       LABEL RECORD IS STANDARD
       VALUE OF FILE-ID IS 'REL.DAT'
       DATA RECORD IS RECMHS.
       01 RECMHS.
             02 NPM PIC 9(8).
             02 NAMA PIC A(25).
             02 KELAS PIC X(5).
             02 NILAI PIC 99.
        WORKING-STORAGE SECTION.
       77 STATUS-SALAH PIC XX.
       77 NO-REL PIC 9(8).
       01 ISI-LAGI PIC X.
       88 LAGI VALUE 'Y', 'y'.
       88 TIDAK VALUE 'T', 't'.
       SCREEN SECTION.
       01 HAPUS-LAYAR.
            02 BLANK SCREEN.
       01 ISI-DATA.
            02 LINE 1 COLUMN 30 'INPUT FILE RELATIF' HIGHLIGHT
                FOREGROUND-COLOR 3
                BACKGROUND-COLOR 5.
            02 LINE 3 COLUMN 5 'NPM : ' HIGHLIGHT.
            02 COLUMN PLUS 1 PIC 9(8) TO NPM.
            02 LINE 4 COLUMN 5 'NAMA : ' HIGHLIGHT.
            02 COLUMN PLUS 1 PIC A(25) TO NAMA.
            02 LINE 5 COLUMN 5 'KELAS : ' HIGHLIGHT.
            02 COLUMN PLUS 1 PIC X(5) TO KELAS.
            02 LINE 6 COLUMN 5 'NILAI : ' HIGHLIGHT.
            02 COLUMN PLUS 1 PIC 99 TO NILAI.
       01  LAYAR-KREDIT.
            02 LINE 12 COLUMN 25 "CREATED BY TONNY" HIGHLIGHT
               FOREGROUND-COLOR 5
               BACKGROUND-COLOR 7.
       PROCEDURE DIVISION.
       BUKA-FILE.
           OPEN OUTPUT MHS.
       MULAI.
           DISPLAY HAPUS-LAYAR
           DISPLAY ISI-DATA
           ACCEPT ISI-DATA.
           COMPUTE NO-REL = NPM - 51402000.
           WRITE RECMHS.
           DISPLAY(10, 5) 'ADA DATA LAGI [Y/T] ? '
           ACCEPT( , ) ISI-LAGI.
           IF LAGI GO TO MULAI
           ELSE
                IF TIDAK
                    DISPLAY HAPUS-LAYAR
                    DISPLAY LAYAR-KREDIT
                    GO TO SELESAI.
       SELESAI.
            CLOSE MHS.
            STOP RUN.

0 komentar:

Posting Komentar