9月 15, 2015

COBOL 顯示所有資料


        ID DIVISION.
        PROGRAM-ID. P0611.
        ENVIRONMENT DIVISION.
        INPUT-OUTPUT SECTION.
        FILE-CONTROL.
        COPY 'UTI\PC.FC'.
        DATA DIVISION.
        FILE SECTION.
        COPY 'UTI\PC.FD'.
        WORKING-STORAGE SECTION.
        01 EOF PIC 9 VALUE 0.
        77 PC-STATUS PIC X(02).

        77 CUT PIC 99 VALUE 0.
        PROCEDURE DIVISION.
        MAIN SECTION.
        MAIN-RTN.
            OPEN I-O PC-FILE.
            PERFORM UNTIL EOF = 1
                READ PC-FILE NEXT AT END MOVE 1 TO EOF
                END-READ
                ADD 1 TO CUT
            END-PERFORM
            SUBTRACT 1 FROM CUT
            PERFORM CUT TIMES
                DISPLAY PC-PASSWORD PC-PROP-ID PC-STCK-ID PC-OFFICE-NAME
                DISPLAY PC-CHINESE-CODE PC-PRINTER-CODE PC-CHAR-DENSITY
                DISPLAY PC-RATE
            END-PERFORM.
            CLOSE PC-FILE.
        MAIN-EXIT.

沒有留言: