Skip to content

Commit fcd47eb

Browse files
committed
Updated README
1 parent dfc5e83 commit fcd47eb

File tree

12 files changed

+395
-89
lines changed

12 files changed

+395
-89
lines changed

README.md

+171-79
Large diffs are not rendered by default.

ec2_based/src/cobdata_to_csv.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def get_cpy_layout(parse_dict):
138138
if parse_dict[item_1][item_2]['signed']:
139139
sign = 'SIGNED'
140140

141-
if 'precision' in parse_dict[item_1][item_2].keys():
142-
scale = parse_dict[item_1][item_2]['precision']
141+
if 'scale' in parse_dict[item_1][item_2].keys():
142+
scale = parse_dict[item_1][item_2]['scale']
143143
else:
144144
scale = 0
145145

lambda_based/mf-unlock-data/cobdata_to_csv.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def get_cpy_layout(parse_dict):
138138
if parse_dict[item_1][item_2]['signed']:
139139
sign = 'SIGNED'
140140

141-
if 'precision' in parse_dict[item_1][item_2].keys():
142-
scale = parse_dict[item_1][item_2]['precision']
141+
if 'scale' in parse_dict[item_1][item_2].keys():
142+
scale = parse_dict[item_1][item_2]['scale']
143143
else:
144144
scale = 0
145145

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*
2+
* Sample Employee Record COBOL Layout
3+
*
4+
01 EMP-RECORD.
5+
05 EMP-ID PIC 9(5).
6+
05 EMP-ID-X REDEFINES EMP-ID PIC X(5).
7+
05 EMP-NAME PIC X(25).
8+
05 EMP-DOB PIC X(10).
9+
05 EMP-ADDRESS OCCURS 3 TIMES.
10+
10 EMP-ADDR-LINE PIC X(25).
11+
05 EMP-YOE-CUR PIC S9(4) COMP.
12+
05 EMP-YOE-TOTAL PIC 9(4)V99 COMP-3.
13+
05 EMP-SALARY PIC S9(4)V99.
14+
05 EMP-SALARY-DIFF PIC S9999V99 COMP-3.
15+
05 EMP-DEPENDENTS-NUM PIC S9(2).
16+
05 FILLER PIC X(17).
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
{
2+
"EMPREC01": {
3+
"0": {
4+
"data_name": "EMP-RECORD",
5+
"group": true,
6+
"level": "01",
7+
"level_depth_9": 1,
8+
"level_depth_x": "01",
9+
"lrecl_max": 150,
10+
"offset": 0
11+
},
12+
"1": {
13+
"data_name": "EMP-ID",
14+
"disp_length": 5,
15+
"level": "05",
16+
"level_depth_9": 2,
17+
"level_depth_x": "01-05",
18+
"numeric": true,
19+
"offset": 0,
20+
"picture": "9(5)",
21+
"scale": 0,
22+
"storage_length": 5
23+
},
24+
"2": {
25+
"data_name": "EMP-ID-X",
26+
"disp_length": 5,
27+
"level": "05",
28+
"level_depth_9": 2,
29+
"level_depth_x": "01-05",
30+
"numeric": false,
31+
"offset": 0,
32+
"picture": "X(5)",
33+
"redefines": "EMP-ID",
34+
"storage_length": 5
35+
},
36+
"3": {
37+
"data_name": "EMP-NAME",
38+
"disp_length": 25,
39+
"level": "05",
40+
"level_depth_9": 2,
41+
"level_depth_x": "01-05",
42+
"numeric": false,
43+
"offset": 5,
44+
"picture": "X(25)",
45+
"storage_length": 25
46+
},
47+
"4": {
48+
"data_name": "EMP-DOB",
49+
"disp_length": 10,
50+
"level": "05",
51+
"level_depth_9": 2,
52+
"level_depth_x": "01-05",
53+
"numeric": false,
54+
"offset": 30,
55+
"picture": "X(10)",
56+
"storage_length": 10
57+
},
58+
"5": {
59+
"data_name": "EMP-ADDRESS",
60+
"group": true,
61+
"level": "05",
62+
"level_depth_9": 2,
63+
"level_depth_x": "01-05",
64+
"occurs": true,
65+
"occurs_max": 3,
66+
"occurs_min": 3,
67+
"offset": 40
68+
},
69+
"6": {
70+
"data_name": "EMP-ADDR-LINE-1",
71+
"disp_length": 25,
72+
"level": "10",
73+
"level_depth_9": 3,
74+
"level_depth_x": "01-05-10",
75+
"numeric": false,
76+
"occurs_now": 1,
77+
"offset": 40,
78+
"picture": "X(25)",
79+
"storage_length": 25
80+
},
81+
"7": {
82+
"data_name": "EMP-ADDR-LINE-2",
83+
"disp_length": 25,
84+
"level": "10",
85+
"level_depth_9": 3,
86+
"level_depth_x": "01-05-10",
87+
"numeric": false,
88+
"occurs_now": 2,
89+
"offset": 65,
90+
"picture": "X(25)",
91+
"storage_length": 25
92+
},
93+
"8": {
94+
"data_name": "EMP-ADDR-LINE-3",
95+
"disp_length": 25,
96+
"level": "10",
97+
"level_depth_9": 3,
98+
"level_depth_x": "01-05-10",
99+
"numeric": false,
100+
"occurs_now": 3,
101+
"offset": 90,
102+
"picture": "X(25)",
103+
"storage_length": 25
104+
},
105+
"9": {
106+
"data_name": "EMP-YOE-CUR",
107+
"disp_length": 4,
108+
"level": "05",
109+
"level_depth_9": 2,
110+
"level_depth_x": "01-05",
111+
"numeric": true,
112+
"offset": 115,
113+
"picture": "S9(4)",
114+
"scale": 0,
115+
"sign": "S",
116+
"signed": true,
117+
"storage_length": 2,
118+
"usage": "COMP"
119+
},
120+
"10": {
121+
"data_name": "EMP-YOE-TOTAL",
122+
"decimal": "V",
123+
"disp_length": 6,
124+
"level": "05",
125+
"level_depth_9": 2,
126+
"level_depth_x": "01-05",
127+
"numeric": true,
128+
"offset": 117,
129+
"picture": "9(4)V99",
130+
"scale": 2,
131+
"storage_length": 4,
132+
"usage": "COMP-3"
133+
},
134+
"11": {
135+
"data_name": "EMP-SALARY",
136+
"decimal": "V",
137+
"disp_length": 6,
138+
"level": "05",
139+
"level_depth_9": 2,
140+
"level_depth_x": "01-05",
141+
"numeric": true,
142+
"offset": 121,
143+
"picture": "S9(4)V99",
144+
"scale": 2,
145+
"sign": "S",
146+
"signed": true,
147+
"storage_length": 6
148+
},
149+
"12": {
150+
"data_name": "EMP-SALARY-DIFF",
151+
"decimal": "V",
152+
"disp_length": 6,
153+
"level": "05",
154+
"level_depth_9": 2,
155+
"level_depth_x": "01-05",
156+
"numeric": true,
157+
"offset": 127,
158+
"picture": "S9999V99",
159+
"scale": 2,
160+
"sign": "S",
161+
"signed": true,
162+
"storage_length": 4,
163+
"usage": "COMP-3"
164+
},
165+
"13": {
166+
"data_name": "EMP-DEPENDENTS-NUM",
167+
"disp_length": 2,
168+
"level": "05",
169+
"level_depth_9": 2,
170+
"level_depth_x": "01-05",
171+
"numeric": true,
172+
"offset": 131,
173+
"picture": "S9(2)",
174+
"scale": 0,
175+
"sign": "S",
176+
"signed": true,
177+
"storage_length": 2
178+
},
179+
"14": {
180+
"data_name": "FILLER-X-100",
181+
"disp_length": 17,
182+
"level": "05",
183+
"level_depth_9": 2,
184+
"level_depth_x": "01-05",
185+
"numeric": false,
186+
"offset": 133,
187+
"picture": "X(17)",
188+
"storage_length": 17
189+
}
190+
}
191+
}
750 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"EMP_ID","EMP_ID_X","EMP_NAME","EMP_DOB","EMP_ADDR_LINE_1","EMP_ADDR_LINE_2","EMP_ADDR_LINE_3","EMP_YOE_CUR","EMP_YOE_TOTAL","EMP_SALARY","EMP_SALARY_DIFF","EMP_DEPENDENTS_NUM","FILLER_X_100"
2+
"00001","00001","Jennifer Cooley ","07/11/1982","P.O. Box 433, 3031 Sem Av","India ","693624 ","+008","+00017.00","+7354.04","+00612.83","+02"," "
3+
"00002","00002","Patience Hanson ","10/04/1985","Ap #839-8598 Nulla Avenue","France ","904878 ","+002","+00016.00","+2155.33","-00179.61","+03"," "
4+
"00003","00003","Ignacia Lynch ","12/14/1984","711-6709 Ornare, Rd. ","Indonesia ","561128 ","+002","+00017.00","+9186.54","+00765.54","+03"," "
5+
"00004","00004","Mariam Dejesus ","08/18/1978","P.O. Box 914, 6128 Sem, S","Turkey ","46307 ","+001","+00018.00","+1890.32","+00157.52","+04"," "
6+
"00005","00005","Kevin Anderson ","07/01/1993","P.O. Box 989, 7831 Mauris","Turkey ","474411 ","+005","+00021.00","+5619.50","-00468.29","+04"," "

run_anywhere/src/cobdata_to_csv.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def get_cpy_layout(parse_dict):
138138
if parse_dict[item_1][item_2]['signed']:
139139
sign = 'SIGNED'
140140

141-
if 'precision' in parse_dict[item_1][item_2].keys():
142-
scale = parse_dict[item_1][item_2]['precision']
141+
if 'scale' in parse_dict[item_1][item_2].keys():
142+
scale = parse_dict[item_1][item_2]['scale']
143143
else:
144144
scale = 0
145145

run_anywhere/src/main.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ def convert_cobdata2csv(input_copybook, input_datafile, output_datafile):
4141

4242
def main():
4343

44-
## Convert AWS.M2.CARDDEMO.ACCTDATA.PS.dat to CSV using copybook ACCTFILE.cpy
45-
input_copybook = os.path.join(project_dir, 'mfdata', 'copybook', 'ACCTFILE.cpy')
46-
input_datafile = os.path.join(project_dir, 'mfdata', 'input', 'AWS.M2.CARDDEMO.ACCTDATA.PS.dat')
47-
output_datafile = os.path.join(project_dir, 'mfdata', 'output', 'AWS.M2.CARDDEMO.ACCTDATA.PS.csv')
44+
## Convert TEST.EMP.RECORD.FILE.dat to csv using copybook EMPREC01.cpy
45+
input_copybook = os.path.join(project_dir, 'mfdata', 'copybook', 'EMPREC01.cpy')
46+
input_datafile = os.path.join(project_dir, 'mfdata', 'input', 'TEST.EMP.RECORD.FILE.dat')
47+
output_datafile = os.path.join(project_dir, 'mfdata', 'output', 'TEST.EMP.RECORD.FILE.csv')
4848
convert_cobdata2csv(input_copybook, input_datafile, output_datafile)
4949

5050
return
569 KB
Loading
611 KB
Loading
360 KB
Loading

0 commit comments

Comments
 (0)