IDENTIFICATION DIVISION.
PROGRAM-ID. FILEKSDS.
AUTHOR. KK.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EFILE ASSIGN
TO DD1
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS ENO
FILE STATUS IS FS1.
DATA DIVISION.
FILE SECTION.
FD EFILE.
01 EREC.
05 ENO PIC X(6).
05 ENAME PIC A(8).
05 FILLER PIC X(10).
05 EDATE PIC A(11).
05 FILLER PIC X(45).
WORKING-STORAGE SECTION.
01 FS1 PIC 9(2).
PROCEDURE DIVISION.
OPEN I-O EFILE
ACCEPT ENO
START EFILE KEY IS = ENO INVALID KEY
DISPLAY 'RECORD NOT FOUND'.
PERFORM 0002-FILE-READ 5 TIMES
CLOSE EFILE
STOP RUN.
0002-FILE-READ.
READ EFILE NEXT RECORD
AT END DISPLAY "END OF FILE"
NOT AT END
DISPLAY EREC
END-READ.
PROGRAM-ID. FILEKSDS.
AUTHOR. KK.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EFILE ASSIGN
TO DD1
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS ENO
FILE STATUS IS FS1.
DATA DIVISION.
FILE SECTION.
FD EFILE.
01 EREC.
05 ENO PIC X(6).
05 ENAME PIC A(8).
05 FILLER PIC X(10).
05 EDATE PIC A(11).
05 FILLER PIC X(45).
WORKING-STORAGE SECTION.
01 FS1 PIC 9(2).
PROCEDURE DIVISION.
OPEN I-O EFILE
ACCEPT ENO
START EFILE KEY IS = ENO INVALID KEY
DISPLAY 'RECORD NOT FOUND'.
PERFORM 0002-FILE-READ 5 TIMES
CLOSE EFILE
STOP RUN.
0002-FILE-READ.
READ EFILE NEXT RECORD
AT END DISPLAY "END OF FILE"
NOT AT END
DISPLAY EREC
END-READ.
No comments:
Post a Comment