-
Notifications
You must be signed in to change notification settings - Fork 0
/
write-file.cob
39 lines (39 loc) · 1.48 KB
/
write-file.cob
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
IDENTIFICATION DIVISION.
PROGRAM-ID. WRITE-FILE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
* EXPORT DD_OUTFILE=output-file in sh before running write_file.exe
SELECT OUTFILE ASSIGN TO "DD_OUTFILE"
ORGANIZATION IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD OUTFILE.
01 RECORDOUT.
02 FILLER PIC X(64).
WORKING-STORAGE SECTION.
01 OUTPUT-RECORD.
03 OUTPUT-RECORD-01 PIC X(32).
03 OUTPUT-RECORD-02 PIC X(32).
PROCEDURE DIVISION.
0000-MAIN.
OPEN OUTPUT OUTFILE.
0010-WRITE-FILE.
MOVE "12345678901234567890123456789012" TO OUTPUT-RECORD-01.
MOVE "34567890123456789012345678901234" TO OUTPUT-RECORD-02.
MOVE OUTPUT-RECORD TO RECORDOUT.
WRITE RECORDOUT.
0020-WRITE-FILE.
MOVE "23456789012345678901234567890123" TO OUTPUT-RECORD-01.
MOVE "45678901234567890123456789012345" TO OUTPUT-RECORD-02.
MOVE OUTPUT-RECORD TO RECORDOUT.
WRITE RECORDOUT.
0030-WRITE-FILE.
MOVE "34567890123456789012345678901234" TO OUTPUT-RECORD-01.
MOVE "56789012345678901234567890123456" TO OUTPUT-RECORD-02.
MOVE OUTPUT-RECORD TO RECORDOUT.
WRITE RECORDOUT.
0040-WRITE-FIOLE.
CLOSE OUTFILE.
9999-EXIT.
STOP RUN.