IDENTIFICATION DIVISION.
PROGRAM-ID. FILEPS.
AUTHOR. KK.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EFILE ASSIGN
TO DD1
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS FS1.
DATA DIVISION.
FILE SECTION.
FD EFILE.
01 EREC.
05 ENO PIC 9(8).
05 FILLER PIC X(5).
05 ENAME PIC A(10).
05 FILLER PIC X(57).
WORKING-STORAGE SECTION.
01 FS1 PIC 9(2).
01 EOF PIC XX.
PROCEDURE DIVISION.
OPEN OUTPUT EFILE
PERFORM 0001-FILE-IN UNTIL EOF = 'Y'
CLOSE EFILE
OPEN INPUT EFILE
PERFORM 0002-FILE-READ UNTIL FS1 = 10
STOP RUN.
0001-FILE-IN.
DISPLAY "FILE OPEN" FS1
ACCEPT ENO
ACCEPT ENAME
ACCEPT EOF
WRITE EREC
DISPLAY "WRITE" FS1.
0002-FILE-READ.
READ EFILE
AT END DISPLAY "END OF FILE"
NOT AT END
DISPLAY EREC
END-READ.
PROGRAM-ID. FILEPS.
AUTHOR. KK.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EFILE ASSIGN
TO DD1
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS FS1.
DATA DIVISION.
FILE SECTION.
FD EFILE.
01 EREC.
05 ENO PIC 9(8).
05 FILLER PIC X(5).
05 ENAME PIC A(10).
05 FILLER PIC X(57).
WORKING-STORAGE SECTION.
01 FS1 PIC 9(2).
01 EOF PIC XX.
PROCEDURE DIVISION.
OPEN OUTPUT EFILE
PERFORM 0001-FILE-IN UNTIL EOF = 'Y'
CLOSE EFILE
OPEN INPUT EFILE
PERFORM 0002-FILE-READ UNTIL FS1 = 10
STOP RUN.
0001-FILE-IN.
DISPLAY "FILE OPEN" FS1
ACCEPT ENO
ACCEPT ENAME
ACCEPT EOF
WRITE EREC
DISPLAY "WRITE" FS1.
0002-FILE-READ.
READ EFILE
AT END DISPLAY "END OF FILE"
NOT AT END
DISPLAY EREC
END-READ.
No comments:
Post a Comment