forked from royopa/cb2xml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReadMe_cb2xml.html
388 lines (346 loc) · 90.2 KB
/
ReadMe_cb2xml.html
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<body>
<h1>Readme for cb2xml 0.95.7</h1>
<p>This version of cb2xml contains fix for 88 levels on comp/comp-3 variables + new python example program.
<ul>
<li><a href="#cb2xmluses">Uses of cb2xml</a></li>
<li><a href="#xmlFormat">cb2xml Xml File description and schemas</a></li>
<li><a href="#howto">How to use cb2xml</a></li>
<li><a href="#Useful">Useful software for Cobol Data</a></li>
<li><a href="#jaxbjar">New Jaxb Jar</a></li>
<li><a href="#changes">Change Summary</a></li>
</ul>
<h2>Warning for Existing users</h2>
<p>In version 0.95.7,the format of the value tag has changed. Basically
<table>
<tr><td><b>Cobol Value clause</b></td><td><b>Xml value tag</b></td></tr>
<tr><td>value 121</td><td>value="121"</td></tr>
<tr><td>value zero</td><td>value="zero"</td></tr>
<tr><td>value 'some text'</td><td>value="'some text'"</td></tr>
<tr><td>value "some other text"</td><td>value=""some other text""</td></tr>
</table>
<h2><a id="cb2xmluses">Uses of cb2xml</a></h2>
There are three main uses of the cb2xml -<ul>
<li>Converting a <b>Cobol Copybook</b> to an equivalent <b>Xml-Copybook</b>. There are many ways of processing this
Xml:<ul>
<li>A sample of
how to process this Xml file using <b>jaxb</b> can be found in <a href="source/cb2xml_examples/src/net/sf/cb2xml/example/Demo2.java">Demo2.java</a>.</li>
<li>The <a href="https://sourceforge.net/projects/jrecord/">JRecord</a> project processes a
<i>cb2xml Xml</i> document
<a href="http://jrecord.cvs.sourceforge.net/viewvc/jrecord/jrecord/src/net/sf/JRecord/External/XmlCopybookLoader.java?view=markup">using a java program</a>.</li>
<a href="https://sourceforge.net/p/jrecord/code/HEAD/tree/jrecord/Source/JRecord_Cbl2Xml/src/net/sf/JRecord/cbl2xml/impl/Cobol2GroupXml.java#l266">JRecord</a> also uses **JAXB** to load copybook details for use in converting Cobol to / from Xml
<li>While the <b>cobol2j</b> project uses an <a href="http://cobol2j.cvs.sourceforge.net/viewvc/cobol2j/cobol2j/src/main/xml/cb2xml2cobol2j.xsl?view=markup">XSL transform</a> to convert
the cb2xml-file-description to its own Xml file-description-format.</li>
<li><a href="http://www.rubydoc.info/gems/copybook_utils/">CopybookUtils</a> is a Ruby Gem for Ruby gem for reading Cobol Text files using cb2xml-Xml copybooks</li>
<li><a href="https://code.google.com/p/cbgen/source/browse/#svn%2Ftrunk%2Fsrc%2Fmain%2Fscala%2Fcom%2Fwasani%2Fcbgen">cbgen</a> Written Scala, it uses it's own Copybook processor to extract
Cobol details</li>
</ul>
</li>
<li>Cobol-data-file to Xml file (Dat2Xml program). There is an enhance version in <a href="https://sourceforge.net/p/jrecord/wiki/Data2Xml%20and%20Xml2Data/">JRecords Data2Xml</a></li>
<li>Xml File to Cobol-data-file (Xml2Dat program). There is an enhance version in <a href="https://sourceforge.net/p/jrecord/wiki/Data2Xml%20and%20Xml2Data/">JRecords Xml2Data</a></li>
</ul>
<b>Note:</b> The Dat2Xml and Xml2Dat have the following limitations:<ul>
<li>only handle text files.</li>
<li>Xml2Dat does not handle arrays !!!.</li>
<li>The size of the files they can handle is fairly limited because both the Cobol-Data file and Xml File (DOM format) are stored in memory during the conversion process</li>
</ul>
<p>All these issues are resolved in <a href="https://sourceforge.net/p/jrecord/wiki/Data2Xml%20and%20Xml2Data/">JRecords Data2Xml / Xml2Data</a>.
<h2><a id="xmlFormat">cb2xml Xml File description and schemas</a></h2>
<p><a href="xmlSchema/cb2xml.xsd">cb2xml.xsd</a> and <a href="xmlSchema/cb2xml.dtd" style="none">cb2xml.dtd</a> xml schemas can be found in the <a href="xmlSchema">xmlSchema</a> directory.</p>
<p>Following is sample Cobol copybook :
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">1 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">03</font> f1 <font color="#006699"><strong>pic</strong></font> x(<font color="#ff0000">3</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">2 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">03</font> f2-comp <font color="#006699"><strong>pic</strong></font> s9(<font color="#ff0000">4</font>) <font color="#006699"><strong>comp</strong></font>.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">3 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">03</font> f3-comp-3 <font color="#006699"><strong>pic</strong></font> s9(<font color="#ff0000">6</font>)V99 <font color="#006699"><strong>comp-3</strong></font>.
</font></pre>
<p>once the Cobol Copybook is processed by cb2xml:</p>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">3 </font></span><font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">03</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">f1</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">x</font><font color="#ff00cc">(</font><font color="#ff00cc">3</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">1</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">4 </font></span><font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">4</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">03</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">f2</font><font color="#ff00cc">-</font><font color="#ff00cc">comp</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">numeric</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">true</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">s9</font><font color="#ff00cc">(</font><font color="#ff00cc">4</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">4</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">signed</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">true</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">2</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">usage</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">computational</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">5 </font></span><font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">8</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">03</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">f3</font><font color="#ff00cc">-</font><font color="#ff00cc">comp</font><font color="#ff00cc">-</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">numeric</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">true</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">s9</font><font color="#ff00cc">(</font><font color="#ff00cc">6</font><font color="#ff00cc">)</font><font color="#ff00cc">V99</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">6</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">scale</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">2</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">signed</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">true</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">5</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">usage</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">computational</font><font color="#ff00cc">-</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
</font></pre>
<p/>
<p>A more compilcated example:</p>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 1 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">01</font> Vendor.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">03</font> Brand <font color="#006699"><strong>Pic</strong></font> x(<font color="#ff0000">3</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">03</font> Location-details.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 4 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">05</font> Location-Number <font color="#006699"><strong>Pic</strong></font> <font color="#ff0000">9</font>(<font color="#ff0000">4</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 5 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">05</font> Location-Type <font color="#006699"><strong>Pic</strong></font> XX.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 6 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">05</font> Location-Name <font color="#006699"><strong>Pic</strong></font> X(<font color="#ff0000">35</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 7 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">03</font> Address-Details.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 8 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">05</font> actual-address.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 9 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">10</font> Address-1 <font color="#006699"><strong>Pic</strong></font> X(<font color="#ff0000">40</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 10 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">10</font> Address-2 <font color="#006699"><strong>Pic</strong></font> X(<font color="#ff0000">40</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 11 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">10</font> Address-3 <font color="#006699"><strong>Pic</strong></font> X(<font color="#ff0000">35</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 12 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">05</font> Postcode <font color="#006699"><strong>Pic</strong></font> <font color="#ff0000">9</font>(<font color="#ff0000">4</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 13 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">05</font> Empty <font color="#006699"><strong>pic</strong></font> x(<font color="#ff0000">6</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 14 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">05</font> State <font color="#006699"><strong>Pic</strong></font> XXX.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 15 </font></span><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font><font color="#cc6600"> </font> <font color="#ff0000">03</font> Location-Active <font color="#006699"><strong>Pic</strong></font> X.
</font></pre>
<p>This is converted into the following <em>Xml</em> by cb2xml, please note <em>Nested Groups</em> in the Cobol get converted to <b>Nested Items</b> in the Xml:</p>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 1 </font></span><font color="#0000ff"><</font><font color="#0000ff">copybook</font><font color="#0000ff"> </font><font color="#0000ff">filename</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">cbl2xml_Test110</font><font color="#ff00cc">.</font><font color="#ff00cc">cbl</font><font color="#ff00cc">"</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">173</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">01</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Ams</font><font color="#ff00cc">-</font><font color="#ff00cc">Vendor</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">1</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">173</font><font color="#ff00cc">"</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">03</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Brand</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">x</font><font color="#ff00cc">(</font><font color="#ff00cc">3</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">1</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 4 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">41</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">03</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Location</font><font color="#ff00cc">-</font><font color="#ff00cc">details</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">4</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">41</font><font color="#ff00cc">"</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 5 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">4</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">05</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Location</font><font color="#ff00cc">-</font><font color="#ff00cc">Number</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">9</font><font color="#ff00cc">(</font><font color="#ff00cc">4</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">4</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">4</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">numeric</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">true</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 6 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">2</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">05</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Location</font><font color="#ff00cc">-</font><font color="#ff00cc">Type</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">XX</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">8</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">2</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 7 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">35</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">05</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Location</font><font color="#ff00cc">-</font><font color="#ff00cc">Name</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">X</font><font color="#ff00cc">(</font><font color="#ff00cc">35</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">10</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">35</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 8 </font></span> <font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">item</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 9 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">128</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">03</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Address</font><font color="#ff00cc">-</font><font color="#ff00cc">Details</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">45</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">128</font><font color="#ff00cc">"</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 10 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">115</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">05</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">actual</font><font color="#ff00cc">-</font><font color="#ff00cc">address</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">45</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">115</font><font color="#ff00cc">"</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 11 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">40</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">10</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Address</font><font color="#ff00cc">-</font><font color="#ff00cc">1</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">X</font><font color="#ff00cc">(</font><font color="#ff00cc">40</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">45</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">40</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 12 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">40</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">10</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Address</font><font color="#ff00cc">-</font><font color="#ff00cc">2</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">X</font><font color="#ff00cc">(</font><font color="#ff00cc">40</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">85</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">40</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 13 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">35</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">10</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Address</font><font color="#ff00cc">-</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">X</font><font color="#ff00cc">(</font><font color="#ff00cc">35</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">125</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">35</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 14 </font></span> <font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">item</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 15 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">4</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">05</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Postcode</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">numeric</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">true</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">9</font><font color="#ff00cc">(</font><font color="#ff00cc">4</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">160</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">4</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 16 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">6</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">05</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Empty</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">x</font><font color="#ff00cc">(</font><font color="#ff00cc">6</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">164</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">6</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 17 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">05</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">State</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">XXX</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">170</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">3</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 18 </font></span> <font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">item</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 19 </font></span> <font color="#0000ff"><</font><font color="#0000ff">item</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">display-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">1</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">level</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">03</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">name</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Location</font><font color="#ff00cc">-</font><font color="#ff00cc">Active</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">picture</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">X</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">position</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">173</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">storage-length</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">1</font><font color="#ff00cc">"</font><font color="#0000ff">/</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 20 </font></span> <font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">item</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 21 </font></span><font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">copybook</font><font color="#0000ff">></font>
</font></pre>
<p/>
<p>The attributes <b>name</b>, <b>numeric</b>, <b>picture</b> and <b>signed</b> are all fairly obvious. The other attributes include:<ul>
<li><b>position</b> - position in the record (1 is the first byte).</li>
<li><b>storage-length</b> - length in bytes of the field.</li>
<li><b>scale</b> - scaling factor, used when there is an assumed decimal point (Cobol V picture) or assumed zero (Cobol P picture).
<ul>
<li>scale=-1 - multiply by 10 (e.g. Picture of S9(4)P)</li>
<li>scale=1 - divide by 10 (e.g. Picture of S9(4)V9)</li>
<li>scale=2 - divide by 100 (e.g. Picture of S9(4)V99)</li>
</ul>
<p><b>Background information:</b> - Cobol uses an "assumed decimal" in representing numbers for expample
a dollar amount could be represented in Cobol as <b>Pic s9(7)V99 comp</b> this is implemented as a binary
integer but where binary 1 actually represent 0.01, i.e. integer values need to be <b>scaled</b></li>.
<li><b>usage</b>, Cobol usage attribute; typically <b>computational</b> is Big-Endian-Binary, <b>computational-3</b> is packed decimal,
<b>computational-5</b> is Machines-Binary-Integer (Little endian on Intel Hardware, big-endian on the Mainframe and Large-servers).</li>
<li><b>editted-numeric</b> - Wether this field is an editted-numeric or not. In Cobol s9(4)V99 is a true numeric and can be used in numeric calculations
while -(3)9.99 is called a <b>editted-numeric</b> but strictly speaking it is a charactger field and <b>can not</b> be used in calculations, only for
formatting. In cb2xml both s9(4)V99 and -(3)9.99 are flagged as numeric but only -(3)9.99 is flagged as editted-numeric.</li>
<li><b>inherited-usage</b> - Normally in cobol the usage is specified on each field:
</ul>
<h2><a id="howto">How to use cb2xml</a></h2>
<p>The <a href="examples/">examples directory</a> holds sample rexx, bat and shell scripts that call <b>cb2xml.jar</b>
to:<ul>
<li>Convert <b>Cobol Copybooks</b> to <i>Xml-File-Descriptions</i> (cobol2xmlFileDescription.*)</li>
<li>Convert <b>Cobol Data</b> files to <i>Xml-Files</i> (data2xml.*) </li>
<li>Convert <b>Xml-Files</b> to <i>Cobol Data</i> files (xml2data.*) </li>
</ul>
<p>Basically to convert a Cobol Copybook to Xml (bat / shell script):
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">7 </font></span>java -jar ../../lib/cb2xml.jar -cobol cbl2xml_Test102.cbl -indentXml -xml cbl2xml_Test102_new3.cbl.xml
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">8 </font></span>java -jar ../../lib/cb2xml.jar -cobol cpyUtf8.cbl -indentXml -font utf-8 -xml cpyUtf8_new4.cbl.xml
</font></pre>
<p>The parameters to cb2xml are:<ul>
<li><b>-cobol</b> - input Cobol copybook</li>
<li><b>-xml</b> - output Xml translation.</li>
<li><b>-font</b> - Copybook font.</li>
<li><b>-indentXml</b> - wether to indent (pretty print) the Xml.</li>
<li><b>-debug</b> - wether
</ul></p>
<p>To load a Cobol Copybook in Java / JVM languages:
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">43 </font></span> Copybook copybook <font color="#000000"><strong>=</strong></font> CobolParser.<font color="#9966ff">newParser</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">44 </font></span> .<font color="#9966ff">parseCobol</font><font color="#000000"><strong>(</strong></font>copybookName<font color="#000000"><strong>)</strong></font>;
</font></pre>
</p>
<p>To create an Xml-Documnet in java:
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 1 </font></span> <font color="#ff8400">//</font><font color="#ff8400"> </font><font color="#ff8400">If</font><font color="#ff8400"> </font><font color="#ff8400">you</font><font color="#ff8400"> </font><font color="#ff8400">want</font><font color="#ff8400"> </font><font color="#ff8400">process</font><font color="#ff8400"> </font><font color="#ff8400">a</font><font color="#ff8400"> </font><font color="#ff8400">cobol</font><font color="#ff8400"> </font><font color="#ff8400">copybook</font><font color="#ff8400"> </font><font color="#ff8400">with</font><font color="#ff8400"> </font><font color="#ff8400">column</font><font color="#ff8400"> </font><font color="#ff8400">specified</font><font color="#ff8400"> </font><font color="#ff8400">in</font><font color="#ff8400"> </font><font color="#ff8400">the</font><font color="#ff8400"> </font><font color="#ff8400">cb2xml.properties</font><font color="#ff8400"> </font><font color="#ff8400">file</font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span> Document doc <font color="#000000"><strong>=</strong></font> Cb2Xml.<font color="#9966ff">convertToXMLDOM</font><font color="#000000"><strong>(</strong></font>cobolCopybookFile<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span> <font color="#ff8400">//</font><font color="#ff8400"> </font><font color="#ff8400">or</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 4 </font></span> Document doc <font color="#000000"><strong>=</strong></font> Cb2Xml2.<font color="#9966ff">convertToXMLDOM</font><font color="#000000"><strong>(</strong></font>cobolCopybookFile, <font color="#cc00cc">false</font>, Cb2xmlConstants.USE_PROPERTIES_FILE<font color="#000000"><strong>)</strong></font>;
</font></pre></p>
<p>By default Cobol uses columns 6 --> 71 but some Cobol-Compilers allow other columns to be used.
To cover for this cb2xml programs has a </p>
<table border="1">
<tbody><tr>
<th align="LEFT" bgcolor="#DADADA" valign="TOP">Copybook Format
</th><th align="LEFT" bgcolor="#DADADA" valign="TOP">Description
</th></tr>
<tr><td><b>Cb2xmlConstants.USE_PROPERTIES_FILE</b></td><td>Get the line lengths from the cb2xml.properties file</td></tr>
<tr><td><b>Cb2xmlConstants.USE_STANDARD_COLUMNS</b></td><td>Standard Cobol Columns (6->71)</td></tr>
<tr><td><b>Cb2xmlConstants.USE_COLS_6_TO_80</b></td><td>Columns 6->80</td></tr>
<tr><td><b>Cb2xmlConstants.USE_LONG_LINE</b></td><td>Use columns 6 to whatever Columns (essentially 6->Max-Int)</td></tr>
<tr><td><b>Cb2xmlConstants.FREE_FORMAT</b></td><td>Free Formet (any column essentially 1->Max-Int) </td></tr>
</tbody>
</table>
<p> </p>
<p><b>Groovy Code</b> to load and print Cobol copybook:</p>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 9 </font></span> <font color="#cc0000">//</font><font color="#cc0000"> </font><font color="#cc0000">Parsing</font><font color="#cc0000"> </font><font color="#cc0000">a</font><font color="#cc0000"> </font><font color="#cc0000">Cobol</font><font color="#cc0000"> </font><font color="#cc0000">copybook</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">10 </font></span> <font color="#009966"><strong>def</strong></font> cpy <font color="#000000"><strong>=</strong></font> CobolParser.<font color="#9966ff">newParser</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">parseCobol</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">cbl2xml_Test110</font><font color="#ff00cc">.</font><font color="#ff00cc">cbl</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">11 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">12 </font></span> <font color="#cc0000">//</font><font color="#cc0000"> </font><font color="#cc0000">Now</font><font color="#cc0000"> </font><font color="#cc0000">lets</font><font color="#cc0000"> </font><font color="#cc0000">print</font><font color="#cc0000"> </font><font color="#cc0000">it</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">13 </font></span> <font color="#66ccff"><strong>print</strong></font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, cpy.<font color="#9966ff">getItem</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">15 </font></span><font color="#cc0000">//</font><font color="#cc0000"> </font><font color="#cc0000">Print</font><font color="#cc0000"> </font><font color="#cc0000">Cobol</font><font color="#cc0000"> </font><font color="#cc0000">item</font><font color="#cc0000"> </font><font color="#cc0000">(and</font><font color="#cc0000"> </font><font color="#cc0000">its</font><font color="#cc0000"> </font><font color="#cc0000">child</font><font color="#cc0000"> </font><font color="#cc0000">items</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span><font color="#009966"><strong>def</strong></font> <font color="#66ccff"><strong>print</strong></font><font color="#000000"><strong>(</strong></font>String indent, List<Item> items<font color="#000000"><strong>)</strong></font> {
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </font></span> <font color="#006699"><strong>for</strong></font> <font color="#000000"><strong>(</strong></font>Item item : items<font color="#000000"><strong>)</strong></font> {
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span> String s <font color="#000000"><strong>=</strong></font> indent <font color="#000000"><strong>+</strong></font> item.<font color="#9966ff">getName</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> s <font color="#000000"><strong>=</strong></font> s.<font color="#9966ff">substring</font><font color="#000000"><strong>(</strong></font><font color="#ff0000">0</font>, <font color="#ff0000">50</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">21 </font></span> <font color="#66ccff"><strong>println</strong></font> s <font color="#000000"><strong>+</strong></font> item.<font color="#9966ff">getPosition</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> item.<font color="#9966ff">getStorageLength</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> item.<font color="#9966ff">getDisplayLength</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>item.<font color="#9966ff">getPicture</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>item.<font color="#9966ff">getUsage</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>item.<font color="#9966ff">isNumeric</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>+</strong></font> <font color="#9966ff">cn</font><font color="#000000"><strong>(</strong></font>item.<font color="#9966ff">isSigned</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">22 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">23 </font></span> <font color="#66ccff"><strong>print</strong></font><font color="#000000"><strong>(</strong></font>indent <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, item.<font color="#9966ff">getItem</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">24 </font></span> }
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">25 </font></span>}
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span>
</font></pre>
<p><b>Python Code</b> to load and print cb2xml - Xml
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">29 </font></span><font color="#006699"><strong>def</strong></font> <font color="#9966ff">printItem</font><font color="#000000"><strong>(</strong></font>indent, item<font color="#000000"><strong>)</strong></font><font color="#006699"><strong>:</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">30 </font></span> n <font color="#000000"><strong>=</strong></font> indent <font color="#000000"><strong>+</strong></font> item.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">level</font><font color="#ff00cc">'</font>] <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> item.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">name</font><font color="#ff00cc">'</font>] <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">31 </font></span> n <font color="#000000"><strong>=</strong></font> n[<font color="#006699"><strong>:</strong></font><font color="#ff0000">50</font>]
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">33 </font></span> <font color="#006699"><strong>print</strong></font> n, <font color="#ff00cc">'</font><font color="#ff00cc">\t</font><font color="#ff00cc">'</font>, item.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">position</font><font color="#ff00cc">'</font>], <font color="#ff00cc">'</font><font color="#ff00cc">\t</font><font color="#ff00cc">'</font>, item.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">storage</font><font color="#ff00cc">-</font><font color="#ff00cc">length</font><font color="#ff00cc">'</font>], <font color="#ff00cc">'</font><font color="#ff00cc">\t</font><font color="#ff00cc">'</font>, <font color="#9966ff">getAttr</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">display</font><font color="#ff00cc">-</font><font color="#ff00cc">length</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>, <font color="#9966ff">getAttr</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">picture</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>, <font color="#9966ff">getAttrId</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">usage</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>, <font color="#9966ff">getAttrId</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">numeric</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>, <font color="#9966ff">getAttrId</font><font color="#000000"><strong>(</strong></font>item, <font color="#ff00cc">'</font><font color="#ff00cc">signed</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">34 </font></span> <font color="#006699"><strong>for</strong></font> child <font color="#006699"><strong>in</strong></font> item.<font color="#9966ff">findall</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">'</font><font color="#ff00cc">item</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font><font color="#006699"><strong>:</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">35 </font></span> <font color="#9966ff">printItem</font><font color="#000000"><strong>(</strong></font>indent <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, child<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">36 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">37 </font></span><font color="#cc0000">#</font><font color="#cc0000">########################################################################</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">38 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">39 </font></span>tree <font color="#000000"><strong>=</strong></font> ET.<font color="#9966ff">parse</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">'</font><font color="#ff00cc">cbl2xml_Test110</font><font color="#ff00cc">.</font><font color="#ff00cc">cbl</font><font color="#ff00cc">.</font><font color="#ff00cc">xml</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">40 </font></span>root <font color="#000000"><strong>=</strong></font> tree.<font color="#9966ff">getroot</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">41 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">42 </font></span><font color="#006699"><strong>print</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">></font><font color="#ff00cc">></font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, root.tag, root.attrib[<font color="#ff00cc">'</font><font color="#ff00cc">filename</font><font color="#ff00cc">'</font>]
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">43 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">44 </font></span><font color="#006699"><strong>for</strong></font> child <font color="#006699"><strong>in</strong></font> root.<font color="#9966ff">findall</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">'</font><font color="#ff00cc">item</font><font color="#ff00cc">'</font><font color="#000000"><strong>)</strong></font><font color="#006699"><strong>:</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">45 </font></span> <font color="#9966ff">printItem</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, child<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">46 </font></span>
</font></pre>
<p><b>Ruby Code</b> to load and print cb2xml - Xml
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">10 </font></span><font color="#006699"><strong>def</strong></font> printXml indent, tree
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">11 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">12 </font></span> tree.each <font color="#006699"><strong>do</strong></font> <font color="#000000"><strong>|</strong></font>node<font color="#000000"><strong>|</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">13 </font></span> <font color="#006699"><strong>puts</strong></font> <font color="#ff00cc">"</font><font color="#000000"><strong>#{</strong></font>indent<font color="#000000"><strong>}</strong></font><font color="#ff00cc"> </font><font color="#000000"><strong>#{</strong></font>node<font color="#000000"><strong>[</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">level</font><font color="#ff00cc">"</font><font color="#000000"><strong>]</strong></font><font color="#000000"><strong>}</strong></font><font color="#ff00cc"> </font><font color="#000000"><strong>#{</strong></font>node<font color="#000000"><strong>[</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">name</font><font color="#ff00cc">"</font><font color="#000000"><strong>]</strong></font><font color="#000000"><strong>}</strong></font><font color="#ff00cc">\t</font><font color="#000000"><strong>#{</strong></font>node<font color="#000000"><strong>[</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">position</font><font color="#ff00cc">"</font><font color="#000000"><strong>]</strong></font><font color="#000000"><strong>}</strong></font><font color="#ff00cc">\t</font><font color="#000000"><strong>#{</strong></font>node<font color="#000000"><strong>[</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">storage</font><font color="#ff00cc">-</font><font color="#ff00cc">length</font><font color="#ff00cc">"</font><font color="#000000"><strong>]</strong></font><font color="#000000"><strong>}</strong></font><font color="#ff00cc">\t</font><font color="#000000"><strong>#{</strong></font>node<font color="#000000"><strong>[</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">picture</font><font color="#ff00cc">"</font><font color="#000000"><strong>]</strong></font><font color="#000000"><strong>}</strong></font><font color="#ff00cc">\t</font><font color="#000000"><strong>#{</strong></font>node<font color="#000000"><strong>[</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">usage</font><font color="#ff00cc">"</font><font color="#000000"><strong>]</strong></font><font color="#000000"><strong>}</strong></font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span> printXml <font color="#ff00cc">"</font><font color="#000000"><strong>#{</strong></font>indent<font color="#000000"><strong>}</strong></font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, node.children
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">15 </font></span> <font color="#006699"><strong>end</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span><font color="#006699"><strong>end</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </font></span> doc <font color="#000000"><strong>=</strong></font> Nokogiri.XML<font color="#000000"><strong>(</strong></font>File.open<font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">cb2xml_Output110</font><font color="#ff00cc">.</font><font color="#ff00cc">xml</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> printXml <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc"> </font><font color="#ff00cc">"</font>, doc.root.children
</font></pre>
<p>To convert a <em>Cobol-Data-file</em> to a <em>DOM Document</em>:</p>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 1 </font></span> String sourceFileContents<font color="#000000"><strong>=</strong></font> FileUtils.<font color="#9966ff">readFile</font><font color="#000000"><strong>(</strong></font>dataFileName<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">toString</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span> Document copyBookXml <font color="#000000"><strong>=</strong></font> XmlUtils.<font color="#9966ff">fileToDom</font><font color="#000000"><strong>(</strong></font>copybookFileName<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 4 </font></span> Document xmlDoc <font color="#006699"><strong>new</strong></font> <font color="#9966ff">MainframeToXml</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">convert</font><font color="#000000"><strong>(</strong></font>sourceFileContents, copyBookXml<font color="#000000"><strong>)</strong></font>;
</font></pre>
<p>To convert <em>Xml</em> file to <em>Cobol-Data</em> file:</p>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 1 </font></span> Document sourceFileXml <font color="#000000"><strong>=</strong></font> XmlUtils.<font color="#9966ff">fileToDom</font><font color="#000000"><strong>(</strong></font>dataFileName<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span> Document copyBookXml <font color="#000000"><strong>=</strong></font> XmlUtils.<font color="#9966ff">fileToDom</font><font color="#000000"><strong>(</strong></font>copybookFileName<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 4 </font></span> String fileData <font color="#000000"><strong>=</strong></font> <font color="#006699"><strong>new</strong></font> <font color="#9966ff">XmlToMainframe</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">convert</font><font color="#000000"><strong>(</strong></font>sourceFileXml, copyBookXml<font color="#000000"><strong>)</strong></font>;
</font></pre>
<p>Examples of processing the cb2xml generated DOM / Xml:</p>
<table border="1">
<tbody><tr>
<th align="LEFT" bgcolor="#DADADA" valign="TOP">Example
</th><th align="LEFT" bgcolor="#DADADA" valign="TOP">Description
</th></tr>
<tr><td><a href="examples/">Examples</a></td><td>There are very basic <a href="examples/PythonExample/">python</a>, <a href="examples/RubyExample/">ruby</a>,
<a href="examples/GroovyExample/">groovy</a>, <a href="examples/JythonExample/">jython</a> and <a href="examples/JRubyExample/">jruby</a> programs to print a <i>cb2xml Xml</i> file</td></tr>
<tr><td><a href="source/cb2xml_examples/src/net/sf/cb2xml/example/Demo.java">Demo.java</a></td><td>A basic program that loads <i>cb2xml Xml</i> via JAXB and then prints the copybook</td></tr>
<tr><td><a href="source/cb2xml_examples/src/net/sf/cb2xml/example/Demo2.java">Demo2.java</a></td><td>A basic program that converts a <i>Cobol Copybook</i> to a DOM document, loads this via JAXB
then prints the copybook</td></tr>
<tr><td><a href="source/cb2xml_examples/src/net/sf/cb2xml/example/DemoCobolJTreeTable.java">DemoCobolJTreeTable.java</a></td><td>A basic program to display a Cobol copybook in a TreeTable.</td></tr>
<tr><td><a href="source/cb2xml_tests/src/tests">source/cb2xml_tests/src/tests</a></td><td>Holds examples of calling cb2xml from java. In particular <i>TstCb2xml02</i> has examples of calling Cb2Xml
to get get a <i>DOM Document</i> and TstCblDataToXml01 call Dat2Xml and Xml2Dat.</td></tr>
<tr><td><a href="source/cb2xml/src/net/sf/cb2xml/convert/MainframeToXml.java">MainframeToXml.java</a></td><td>Uses a <b>cb2xml-Xml</b> file to convert a <i>Cobol-Text</i> file to Xml</td></tr>
<tr><td><a href="source/cb2xml/src/net/sf/cb2xml/convert/XmlToMainframe.java">XmlToMainframe.java</a></td><td>Uses a <b>cb2xml-Xml</b> file to convert a <i>Xml</i> file to a <i>Cobol-Text</i> file.</td></tr>
<tr><td><a href="http://jrecord.cvs.sourceforge.net/viewvc/jrecord/jrecord/src/net/sf/JRecord/External/XmlCopybookLoader.java?view=markup">JRecord - XmlCopybookLoader</a></td><td>JRecords code to process a <i>cb2xml Xml</i> Document.</td></tr>
<tr><td><a href="http://cobol2j.cvs.sourceforge.net/viewvc/cobol2j/cobol2j/src/main/xml/cb2xml2cobol2j.xsl?view=markup">XSL transform</a></td><td>
Xsl Transform used in the cobol2j package to convert <b>cb2xml-Xml</b> ot its own Xml format. This method does not work for all possible Cobol Copybooks.</td></tr>
<tr><td><a href="source/cb2xml_examples/src/net/sf/cb2xml/example/PrettyPrintCopybook.java">Pretty Print</a></td><td>uses a StAX parser to process the Xml.
</tbody>
</table>
<p>
<h2><a id="Useful">Useful software for Cobol Data</a></h2>
<p>If you need to work with Cobol files, you may find some of this software useful:<ul>
<li>The <a href="https://sourceforge.net/projects/record-editor/">RecordEditor</a> lets you view/edit Cobol-data files
with a cobol copybook (you have to import the cobol copybook into the RecordEditor).</li>
<li>If you need to process binary Cobol files in Java consider
<a href="https://sourceforge.net/projects/jrecord/">JRecord</a>, cobol2j or one of several other packages.</li>
<li>For Cobol Data to/from Csv, have a look at JRecords <a href="https://sourceforge.net/p/jrecord/wiki/Data2Xml%20and%20Xml2Data/">JRecords Data2Xml / Xml2Data</a>.
<a href="https://sourceforge.net/p/jrecord/wiki/Cobol2Xml%2C%20Xml2Cobol/">Cobol2Csv and Csv2Cobol</a> programs.</li>
<li>For Cobol to/from Xml look at JRecords
<li>Another processing option is the <a href="http://www.legsem.com/legstar/">legstar</a> packages.</li>
</ul>
<p>
<h2><a id="jaxbjar">New Jaxb Jar</a></h2>
<p>A new Jar cb2xml_Jaxb.jar has been crated. This jar holds Java Copybook and Item classes + code to create
them from either a Cobol Copybook or a cb2xml-Xml file.
<p>Longer term if there is enough interest in the jars contents, it will be included in the standard cb2xml.jar. The trouble with
including it now is I will be stuck with it even hardly any one uses it.
<a id="changes"/>
<h2>Future Changes</h2>
<ul>
<li>I am hoping to bring support for other Cobol Dialects (e.g. Gnu-Cobol) to cb2xml.</li>
<li>I will also add a tag for the actual field type (e.g packed-decimal
Mainframe-Zoned-Decimal, Fujitsu-zoned decimal, Packed-decimal etc).
<li>Option to return a <b>copyook</b> and <b>Item</b> class so you users of Cb2Xml do not need to pass the <b>Document</b>.
</ul>
<h2>Changes Version 0.95.7</h2>
<ul>
<li>Updated the value tag. Text values are now in quotes to distinguish them from numeric and cobol constants (like zero, spaces etc).
<table>
<tr><td><b>Cobol Value clause</b></td><td><b>Xml value tag</b></td></tr>
<tr><td>value 121</td><td>value="121"</td></tr>
<tr><td>value zero</td><td>value="zero"</td></tr>
<tr><td>value 'some text'</td><td>value="'some text'"</td></tr>
<tr><td>value "some other text"</td><td>value=""some other text""</td></tr>
</table></li>
<li>Adding a justified tag (for when justified or justified right is used in the Cobol Copybook).</li>
of a copybook + <i>Cobol move copybook</i> to move values from the Text-Copybook
</ul>
<h2>Changes Version 0.95.6</h2>
<ul>
<li>Fix for 88 levels on comp/comp-3 values.</li>
<li>Added <b>toTextCopybook.py</b> example program. It will create a <i>Text</i> version
of a copybook + <i>Cobol move copybook</i> to move values from the Text-Copybook
</ul>
<h2>Changes Version 0.95.5</h2>
<ul>
<li>Fix for position after redefines.</li>
<li>Added <b>ObscureCobol</b> example program. It will "Obfuscate" a Cobol copybook.
</ul>
<h2>Changes Version 0.95.4</h2>
<ul>
<li>Added support for the use of Reader (instead of stream) in the library</li>
<li>Added -font and -indentXml options</li>
</ul>
<h2>Changes Version 0.95.3</h2>
<ul>
<li>Fix for usage specified at the Group Level</li>
<li>Fix for dropping quotes in value tag</li>
<li>Added support continuation of value across multiple lines</li>
<li>New JAXB jar for accessing cb2xml - Xml.</li>
<li>Added examples in Ruby, JRuby, Jython and Groovey. Updated python example.</li>
<li>Added 2 new Xml tags: <b>editted-numeric</b> and <b>inherited-usage</b>.
<li>Updated documentation.
</ul>
<h2>Changes Version 0.95.2</h2>
<ul>
<li>Fix for USE_SUPPLIED_COLUMNS option.
</ul>
<h2>Changes Version 0.95.1</h2>
<ul>
<li>Created a new class <b>Cb2Xml2</b> which is like the <i>Cb2Xml</i> class except it does not trap errors !!</li>
<li>Minor improvements in the error messages from the Cobol Parser.</li>
<li>Created DTD and Xsd schemas for the Xml created by cb2xml.</li>
<li>Created Java Jaxb example programs for processing cb2xml Xml.</li>
<li>Created a basic python program to print cb2xml Xml.</li>
</ul>
<h2>Changes Version 0.95</h2>
<ul>
<li>Improved support for P picture character, new assumed digits tag + Scale can be negative (due to P picture option).</li>
<li>Introduced constant class for the attributes used by Cb2xml. This allows other projects to integrate better with cb2xml</li>
<li>Most methods accept stream as well File (Feature request 1)</li>
<li>Support for Hex literals (patch 1)</li>
<li>Support for sync keyword</li>
<li>Fixed issue with fields starting with numerics</li>
<li>Fixed issue with comments at start of copybook in dat2xml and xml2dat</li>
<li>Fixed issue with “anonymous” REDEFINES (problem 12)</li>
<li>Fixed issue with sign seperate (problem 6)</li>
<li>Option to pass columns to CobolPreprocessor. This means when the calling program passes the start/end column the file cb2xml.properties is not needed anymore.</li>
<li>Added some basic Automated Tests, this will allow regular releases in the future.</li>
<li>dat2xml - trim numerics</li>
<li>dat2xml - Fixed issue with occurs (problem 4 and 10)</li>
<li>xml2dat - Changed to set field to spaces (when tag is absent in the Xml and no initialise is set). (problem 11).</li>
<li>xml2dat - fix for when incoming data is not the expected cobol length</li>
</ul>
</body>