-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestdatafile01.cbl
More file actions
211 lines (209 loc) · 8.12 KB
/
Copy pathtestdatafile01.cbl
File metadata and controls
211 lines (209 loc) · 8.12 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
identification division.
program-id. testdatafile01.
* file creater program
environment division.
configuration section.
source-computer.
System76
* with debugging mode
.
repository.
function all intrinsic.
input-output section.
file-control.
* select i-file1 assign "null.file"
select i-file1 assign "yobALL.txt"
organization is line sequential.
select i-file2 assign "last.all.txt"
organization is line sequential.
select i-file3 assign "newdedup.address.csv"
organization is line sequential.
select i-file4 assign "zip.city.state.csv"
organization is line sequential.
select o-file5 assign "testdatafile01.out"
organization is line sequential.
data division.
file section.
fd i-file1.
01 i-file1-rec.
88 i-file1-eof value high-values.
05 i-file1-first-name pic x(15).
fd i-file2.
01 i-file2-rec.
88 i-file2-eof value high-values.
05 i-file2-last-name pic x(13).
fd i-file3.
01 i-file3-rec.
88 i-file3-eof value high-values.
05 i-file3-address pic x(33).
fd i-file4.
01 i-file4-rec.
88 i-file4-eof value high-values.
05 i-file4-csz pic x(36).
fd o-file5.
01 o-file5-rec.
05 o-file5-rec-count pic 9(09).
05 o-file5-first-name pic x(15).
05 o-file5-last-name pic x(13).
05 o-file5-house-number pic x(08).
05 o-file5-street-name pic x(30).
05 o-file5-city pic x(30).
05 o-file5-state pic x(02).
05 o-file5-zip pic x(05).
05 o-file5-year-pay pic 9(09).
working-storage section.
01 record-counts.
05 file1-count pic 9(09).
05 file2-count pic 9(09).
05 file3-count pic 9(09).
05 file4-count pic 9(09).
05 file5-count pic 9(09).
01 table-subscript.
05 file1-ss pic 9(09).
05 file2-ss pic 9(09).
05 file3-ss pic 9(09).
05 file4-ss pic 9(09).
05 file5-ss pic 9(09).
01 fname-table.
05 fname-tbl occurs 40493 times.
10 fname-rec pic x(15).
01 lname-table.
05 lname-tbl occurs 88799 times.
10 lname-rec pic x(13).
01 housestreet-table.
05 hst-tbl occurs 252600 times.
10 hst-rec.
15 house-num pic x(08).
15 street-name pic x(30).
01 csz-table.
05 csz-tbl occurs 42522 times.
10 csz-rec.
15 csz-city pic x(30).
15 csz-state pic x(02).
15 csz-zip pic x(05).
procedure division.
perform 1000-read-load-files
perform 2000-random-write-file
move zeroes to return-code
goback
.
1000-read-load-files.
open input i-file1
read i-file1
at end move high-values to i-file1-rec
end-read
if i-file1-eof
display "file1 empty" upon syserr
move -1 to return-code
stop run
end-if
perform 1100-read-file1 until i-file1-eof
close i-file1
open input i-file2
read i-file2
at end move high-values to i-file2-rec
end-read
if i-file2-eof
display "file2 empty" upon syserr
move -1 to return-code
stop run
end-if
perform 1200-read-file2 until i-file2-eof
close i-file2
open input i-file3
read i-file3
at end move high-values to i-file3-rec
end-read
if i-file3-eof
display "file3 empty" upon syserr
move -1 to return-code
stop run
end-if
perform 1300-read-file3 until i-file3-eof
close i-file3
open input i-file4
read i-file4
at end move high-values to i-file4-rec
end-read
if i-file4-eof
display "file4 empty" upon syserr
move -1 to return-code
stop run
end-if
perform 1400-read-file4 until i-file4-eof
close i-file4
.
1100-read-file1.
add 1 to file1-count
move i-file1-first-name to fname-rec(file1-count)
read i-file1
at end move high-values to i-file1-rec
end-read
.
1200-read-file2.
add 1 to file2-count
move i-file2-last-name to lname-rec(file2-count)
read i-file2
at end move high-values to i-file2-rec
end-read
.
1300-read-file3.
add 1 to file3-count
unstring i-file3-rec delimited by ',' into
house-num(file3-count)
street-name(file3-count)
end-unstring
read i-file3
at end move high-values to i-file3-rec
end-read
.
1400-read-file4.
add 1 to file4-count
unstring i-file4-rec delimited by ',' into
csz-zip(file4-count)
csz-city(file4-count)
csz-state(file4-count)
read i-file4
at end move high-values to i-file4-rec
end-read
.
2000-random-write-file.
open output o-file5
initialize o-file5-rec
perform 100000 times
add 1 to o-file5-rec-count
perform 2100-random-fname
perform 2200-random-lname
perform 2300-random-address
perform 2400-random-csz
perform 2500-random-pay
perform 2900-write-file5
end-perform
close o-file5
.
2100-random-fname.
compute file1-ss = 1 + 40493 * random
move fname-rec(file1-ss) to o-file5-first-name
.
2200-random-lname.
compute file2-ss = 1 + 88799 * random
move lname-rec(file2-ss) to o-file5-last-name
.
2300-random-address.
compute file3-ss = 1 + 252600 * random
move house-num(file3-ss) to o-file5-house-number
move street-name(file3-ss) to o-file5-street-name
.
2400-random-csz.
compute file4-ss = 1 + 42522 * random
move csz-city(file4-ss) to o-file5-city
move csz-state(file4-ss) to o-file5-state
move csz-zip(file4-ss) to o-file5-zip
.
2500-random-pay.
compute file5-ss = 1 + 19999999 * random
move file5-ss to o-file5-year-pay
.
2900-write-file5.
write o-file5-rec
.