IDENTIFICATION DIVISION.
PROGRAM-ID. FILEIO.
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 I-O EFILE
PERFORM 0002-FILE-READ UNTIL FS1 = 10
STOP RUN.
0002-FILE-READ.
READ EFILE
AT END
DISPLAY "END OF FILE"
NOT AT END
IF ENO = 00000013
MOVE "RANDOMNAME" TO ENAME
REWRITE EREC END-REWRITE
ELSE
CONTINUE
END-IF
END-READ.
PROGRAM-ID. FILEIO.
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 I-O EFILE
PERFORM 0002-FILE-READ UNTIL FS1 = 10
STOP RUN.
0002-FILE-READ.
READ EFILE
AT END
DISPLAY "END OF FILE"
NOT AT END
IF ENO = 00000013
MOVE "RANDOMNAME" TO ENAME
REWRITE EREC END-REWRITE
ELSE
CONTINUE
END-IF
END-READ.
No comments:
Post a Comment