-
Notifications
You must be signed in to change notification settings - Fork 37
/
FILCPY
49 lines (49 loc) · 1.5 KB
/
FILCPY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ID DIVISION.
PROGRAM-ID. COPYPS.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO INDD
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS WS-STAT.
SELECT OUTFILE ASSIGN TO OUTDD
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS WS-STAT1.
DATA DIVISION.
FILE SECTION.
FD INFILE
RECORDING MODE IS F
RECORD CONTAINS 36 CHARACTERS.
COPY EMPREC
REPLACING ==EMPREC== BY ==EMPREC-IN==.
FD OUTFILE
RECORDING MODE IS F.
COPY EMPREC
REPLACING ==EMPREC== BY ==EMPREC-OUT==.
WORKING-STORAGE SECTION.
77 ARE-THERE-ANY-RECORDS PIC X VALUE 'Y'.
88 NO-MORE-RECORDS VALUE 'N'.
77 WS-STAT PIC X(2) VALUE SPACE.
77 WS-STAT1 PIC X(2) VALUE SPACE.
PROCEDURE DIVISION.
MAIN-PARA.
PERFORM OPEN-PARA.
PERFORM PROCESS-PARA UNTIL NO-MORE-RECORDS.
PERFORM CLOSE-PARA.
STOP RUN.
OPEN-PARA.
OPEN INPUT INFILE
OUTPUT OUTFILE.
PROCESS-PARA.
READ INFILE
AT END
MOVE 'N' TO ARE-THERE-ANY-RECORDS
NOT AT END
MOVE EMPREC-IN TO EMPREC-OUT
WRITE EMPREC-OUT
DISPLAY WS-STAT
END-READ.
CLOSE-PARA.
CLOSE INFILE, OUTFILE.