-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathJRecordIntro.htm
1362 lines (1340 loc) · 268 KB
/
JRecordIntro.htm
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
<HTML><HEAD>
<TITLE>Getting Started with JRecord</TITLE>
<!-- Begin Header Records ========================================== -->
<!-- F:\Work\JRecord\Documentation\JRecordIntro.dcf converted by B2H -->
<!-- R4.7 (390) (WINNT) on 20 Jul 2016 at 17:36:01 -->
<META HTTP-EQUIV="updated" CONTENT="Wed, 20 Jul 2016 17:35:56">
<META HTTP-EQUIV="review" CONTENT="Thu, 20 Jul 2017 17:35:56">
<META HTTP-EQUIV="expires" CONTENT="Fri, 20 Jul 2018 17:35:56">
</HEAD><BODY>
<!-- End Header Records ============================================ -->
<A NAME="Top_Of_Page"></A>
<P>
<P>
<P>
<P>
<P>
<P>
<P>
<P>
<P>
<a name="Toc"/>
<P><B><A NAME="ToC_1" HREF="#Header_1" >Getting Started with JRecord</A></B><BR>
<MENU>
<LI><A NAME="ToC_2" HREF="#Header_2" >Introduction</A>
<LI><A NAME="ToC_3" HREF="#HDRIOBLDR" >IO Builders</A>
<MENU>
<LI><A NAME="ToC_4" HREF="#Header_4" >Creating a Cobol IOBuilder</A>
<LI><A NAME="ToC_5" HREF="#Header_5" >Generatng IOBuilder Code</A>
<LI><A NAME="ToC_6" HREF="#Header_6" >Getting help</A>
<LI><A NAME="ToC_7" HREF="#HDRSETFONT" >setFont</A>
<LI><A NAME="ToC_8" HREF="#HDRSETDIALECT" >setDialect</A>
<LI><A NAME="ToC_9" HREF="#HDRSETSPLIT" >setSplitCopybook</A>
<LI><A NAME="ToC_10" HREF="#HDRSETFILEORGANIZATION" >setFileOrganization</A>
</MENU>
<LI><A NAME="ToC_11" HREF="#Header_11" >Cobol Examples</A>
<MENU>
<LI><A NAME="ToC_12" HREF="#HDRREADCBL" >Reading a simple Binary EBCDIC file</A>
<LI><A NAME="ToC_13" HREF="#Header_13" >Reading a Multi-Record Cobol File</A>
<LI><A NAME="ToC_14" HREF="#Header_14" >Duplicate Field names</A>
</MENU>
<LI><A NAME="ToC_15" HREF="#Header_15" >Csv files</A>
<MENU>
<LI><A NAME="ToC_16" HREF="#Header_16" >Reading a CSV file with Names on the first line</A>
<LI><A NAME="ToC_17" HREF="#Header_17" >Reading a CSV file with out column names on the first line</A>
<LI><A NAME="ToC_18" HREF="#Header_18" >Reading a Csv with byte delimiter</A>
<LI><A NAME="ToC_19" HREF="#Header_19" >Writing a Csv File</A>
</MENU>
<LI><A NAME="ToC_20" HREF="#Header_20" >Reading and Writing Fixed Width Files</A>
<MENU>
<LI><A NAME="ToC_21" HREF="#Header_21" >Defining a file by Field-Lengths</A>
<LI><A NAME="ToC_22" HREF="#Header_22" >Defining a file by Field-Positions</A>
</MENU>
<LI><A NAME="ToC_23" HREF="#HDRXMLSCHEMA" >Xml Schema</A>
<LI><A NAME="ToC_24" HREF="#Header_24" >RecordEditor</A>
<MENU>
<LI><A NAME="ToC_25" HREF="#Header_25" >RecordEditor Code Generation</A>
<LI><A NAME="ToC_28" HREF="#HDRCBLIMPORT" >RecordEditor Cobol Import</A>
<LI><A NAME="ToC_29" HREF="#HDRREGENJR" >Generate JRecord code</A>
<LI><A NAME="ToC_30" HREF="#Header_30" >Cobol Copybok Display</A>
<LI><A NAME="ToC_31" HREF="#Header_31" >File Compare</A>
</MENU>
<LI><A NAME="ToC_32" HREF="#HDRCODEGEN" >JRecord Code Generation</A>
<MENU>
<LI><A NAME="ToC_33" HREF="#HDRUSECODEGEN" >Uses of CodeGen code</A>
</MENU>
<LI><A NAME="ToC_34" HREF="#HDRITEMSCHEMA" >Cobol Item Schema Details</A>
<MENU>
<LI><A NAME="ToC_35" HREF="#HDRCBLSR" >CobolSchemaReader</A>
</MENU>
<LI><A NAME="ToC_36" HREF="#HDRCBL2CSV" >Cobol2Csv & Csv2Cobol programs</A>
<LI><A NAME="ToC_37" HREF="#HDRCBL2XML" >Cobol to/from Xml</A>
<MENU>
<LI><A NAME="ToC_38" HREF="#Header_38" >Program Options for Data2Xml and Xml2Data</A>
<LI><A NAME="ToC_39" HREF="#Header_39" >Calling Cobol2Xml from the shell</A>
<LI><A NAME="ToC_40" HREF="#Header_40" >Calling Cobol2Xml from Java</A>
</MENU>
<LI><A NAME="ToC_41" HREF="#HDRCBL2JSON" >Cobol to Json</A>
<MENU>
<LI><A NAME="ToC_42" HREF="#Header_42" >Program options for Cobol2Json</A>
<LI><A NAME="ToC_43" HREF="#Header_43" >Calling from the shell</A>
<LI><A NAME="ToC_44" HREF="#Header_44" >Calling Cobol2Json from Java/JVM</A>
</MENU></MENU><P>
<HR><H1><A NAME="Header_1" HREF="#ToC_1" >Getting Started with JRecord</A></H1>
<HR><H2><A NAME="Header_2" HREF="#ToC_2" >Introduction</A></H2>
<P>This document covers the basic JRecord Operation using the IOBuilder interface, Cobol2Csv / Csv2Cobol programs and Cobol2Xml / Xml2Cobol programs.
For most user's the IOBuilder interface is the easiest way to use JRecord. For those writing utilities/need maximum flexibility you
may need to look at
<a href="Classic_JRecord_Basics.html">Classic JRecord Basics</a>
and <A HREF="#HDRITEMSCHEMA">"Cobol Item Schema Details"</A> as well.
<P>Basically you can read/write Cobol data files by:
<UL COMPACT>
<LI><A HREF="#HDRCBL2CSV">"Cobol2Csv & Csv2Cobol programs"</A> - Convert Cobol Data files to / from Csv files. They are useful for processing simple Cobol Data files.
<LI><A HREF="#HDRCBL2XML">"Cobol to/from Xml"</A> - Convert Cobol Files to/from Xml.
<LI><A HREF="#HDRCBL2JSON">"Cobol to Json"</A> - Convert cobol Files to JSon
<LI>JRecord <A HREF="#HDRIOBLDR">"IO Builders"</A> - A <B>simple interface</B> to <B>JRecord</B> that allows access to complicated Cobol Data files (multi record, binary ??, duplicate field names etc).
<LI>
<a href="Classic_JRecord_Basics.html">Classic JRecord</a> - Older more complicated interface.
<LI><A HREF="#HDRCBLIMPORT">"RecordEditor Cobol Import"</A> - In the <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> <B>Cobol import</B>, you can specify both a <I>Cobol Copybook</I> and
a sample <I>Cobol Data</I> file. The <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> will try and work out the appropriate attributes for the file.
You then have the option of generating a <I>JRecord IOBuilder</I> for the file. This should be useful for
new users.
<LI><A HREF="#HDRCODEGEN">"JRecord Code Generation"</A> - Can be used to generate Skelton <I>Java~JRecord</I> programs from a <I>Cobol</I> Copybook.
</UL>
<P>
<P>The <font color="blue">Cobol2Csv</font> and <font color="blue">Cobol2Xml</font> interfaces are useful because
<UL COMPACT>
<LI>Cobol Interface is isolated to 2 programs.
<LI>Any language that supports Csv/Xml can be used.
<LI>They allows Cobol programmers to talk <B>Cobol</B> and the Java/Python/... programmers to
work with files Formats (Csv / Xml) that they are confortable with.
</UL>
<P>
<HR><H2><A NAME="HDRIOBLDR" HREF="#ToC_3" >IO Builders</A></H2>
<P><H3><A NAME="Header_4" HREF="#ToC_4" >Creating a Cobol IOBuilder</A></H3>
<P>The easiest way to create an IO Builder is via the <B>JRecordInterface1</B> class:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> ICobolIOBuilder iob <font color="#000000"><strong>=</strong></font> JRecordInterface1.COBOL
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">42 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font>copybookName<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">43 </font></span> .<font color="#9966ff">setFont</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">cp037</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font> <font color="#ff8400">//</font><font color="#ff8400"> </font><font color="#ff8400">US</font><font color="#ff8400"> </font><font color="#ff8400">EBCDIC</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">44 </font></span> .<font color="#9966ff">setFileOrganization</font><font color="#000000"><strong>(</strong></font>Constants.IO_FIXED_LENGTH_RECORDS<font color="#000000"><strong>)</strong></font>;
</font></pre>
<P>
<P>The methods available for <B>Cobol IO Builder</B> include
<UL COMPACT>
<LI>setFont - set Font or Characterset
<LI>setDialect - specify the Cobol dialect (Default=Mainframe)
<LI>setFileOrganization - Specify how the Records are organised in the file.
</UL>
<P>
<P><H3><A NAME="Header_5" HREF="#ToC_5" >Generatng IOBuilder Code</A></H3>
<P>To make it easier to get started using JRecord IOBuilders, there 3 code generation options:
<TABLE CELLPADDING="3">
<TR VALIGN="TOP"><TD><P><B>JRecord CodeGen </B></TD><TD><P>The <B>CodeGen</B> program will produce <font color="blue">Java~JRecord</font> from a <B>Cobol Copybook</B>.
See <A HREF="#HDRCODEGEN">"JRecord Code Generation"</A> for more <B>details</B>
</TD></TR><TR VALIGN="TOP"><TD><P><B>RecordEdit CodeGen</B></TD><TD><P>The <B>CodeGen</B> program is now included in the <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a>, it is available under the <B>Generate</B>
option. See
<a href="RecordEditorGenerate.htm">RecordEditor Generate documentation</a> for more details
</TD></TR><TR VALIGN="TOP"><TD><P><B>RecordEditor Cobol Import</B></TD><TD><P>In the <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> Cobol Import dialog, you can enter both a <B>Cobol Copybook</B>
and a <B>Cobol Data File</B>. The <B>RecordEditor Cobol Import</B> dialog will try and work
the file attributes for you. Press the <B>Generate JREcord Code</B> and the system will generate 2 files:
<UL COMPACT>
<LI>A sample JRecord IOBuilder
<LI>A class that defines the Cobol field names as constants.
You can then use Code Completion in you IDE rather than entering the Cobol names.
</UL>
<P>This option will be <font color="blue"><b>usefull</b></font> to <font color="blue"><b>new users</b></font> who are
unsure of what attributes to use in IOBuilder's. See <A HREF="#HDRCBLIMPORT">"RecordEditor Cobol Import"</A> for more <B>details</B>
</TD></TR></TABLE>
<P>
<P>
<P><H3><A NAME="Header_6" HREF="#ToC_6" >Getting help</A></H3>
<P>There are JavaDoc descriptions for the IOBuilder methods. The JavaDoc will explain the options for the method. In
Eclipse you should see:
<P>
<img SRC="Diagram/JR_IOBuilder03.png">
<P>
<P><H3><A NAME="HDRSETFONT" HREF="#ToC_7" >setFont</A></H3>
<P>Set the character-set (font) of the file, I suggest you <font color="blue"><b>Always</b></font> set this field,
it will default to a single byte font (ascii for most Operating systems). The setFont method:
<P>
<img SRC="Diagram/JR_IOBuilder_setFont.png">
<P>
<P>Typically values are cp037 (American Ascii), cp1252, UTF-8.
<P>
<P><H3><A NAME="HDRSETDIALECT" HREF="#ToC_8" >setDialect</A></H3>
<P>Set the Cobol Dialect, the default value is Mainframe. Other options include
ICopybookDialects.FMT_MAINFRAME_COMMA_DECIMAL (for the Germans etc), ICopybookDialects.FMT_GNU_COBOL etc.
<P>
<img SRC="Diagram/JR_IOBuilder01.png">
<P>
<P><H3><A NAME="HDRSETSPLIT" HREF="#ToC_9" >setSplitCopybook</A></H3>
<P>Tells JRecord if / how to split a cobol copybook into seperate Records:
<P>
<img SRC="Diagram/JR_IOBuilder02.png">
<P>
<P>You would use this option as:
<UL>
<P><LI><B>CopybookLoader.SPLIT_NONE</B> where Records are redefined:
<PRE> 01 Input-Record.
05 Field-1 pic x(..).
05 Field-2 pic s9(4) comp.
...
05 Field-n pic x(..).
</PRE><P><P><LI><B>CopybookLoader.SPLIT_REDEFINE</B> for simple single record copybooks
<PRE>
01 Output-Record.
05 Common-Record-Header.
10 Record-type
...
05 Record-1.
.....
05 Record-2 redefines Record-1.
.....
05 Record-3 redefines Record-1.
.....
</PRE><P><LI><B>CopybookLoader.SPLIT_01_LEVEL</B> where Records are redefined:
<PRE>
01 Record-1.
05 Record-Type
....
01 Record-2.
05 Record-Type
....
01 Record-2.
05 Record-Type
....
</PRE><P><LI><B>CopybookLoader.SPLIT_HIGHEST_REPEATING</B> where Records are redefined:
<PRE>
05 Header-Record.
....
05 Detail-Record.
....
05 Trailer-Record.
....
</PRE></UL><P><P><H3><A NAME="HDRSETFILEORGANIZATION" HREF="#ToC_10" >setFileOrganization</A></H3>
<P>In the cobol world, files are not always the cr delimited Text files you are
familiar with in the Windows / *nix world. In Cobol, files can be
<TABLE CELLPADDING="3">
<TR VALIGN="TOP"><TD><P><B>Fixed-Width </B></TD><TD><P>Every Record (line) is the same Length, there are <font color="blue"><b>no cr/lf</b></font>
Record terminators.
</TD></TR><TR VALIGN="TOP"><TD><P><B>Variable Length </B></TD><TD><P>Each Record is precedded by the record length (2/4 byte binary integer).
There is no single <I>VB</I> Each Cobol compiler implements it differently.
</TD></TR></TABLE>
<P>
<P>The <B>setFileOrganization</B> method lets you define File-Organisation (or File Structure)
of the Cobol data file.
<P>
<P>JavaDoc details
<P>
<img SRC="Diagram/JR_IOBuilder_setFileStructure.png">
<P>
<P>Typical values are:
<TABLE CELLPADDING="3">
<TR VALIGN="TOP"><TD><P><B>Constants.IO_FIXED_LENGTH </B></TD><TD><P>Fixed Length Records (no cr/lf) using an 8 bit characterset (e.g. ascii). It could be
binary
</TD></TR><TR VALIGN="TOP"><TD><P><B>Constants.IO_FIXED_LENGTH_CHAR </B></TD><TD><P>Fixed Length Character Records (no cr/lf). Typically used for utf-8 / utf-16 files.
</TD></TR><TR VALIGN="TOP"><TD><P><B>Constants.IO_VB </B></TD><TD><P>IBM Mainframe VB file (each record is preceded by a Record-Length
</TD></TR><TR VALIGN="TOP"><TD><P><B>Constants.IO_VB_DUMP </B></TD><TD><P>IBM Mainframe VB file with both the Block-Lengths and Record-Lengths included
</TD></TR></TABLE>
<P>
<HR><H2><A NAME="Header_11" HREF="#ToC_11" >Cobol Examples</A></H2>
<P>Following of processing Common files.
<P>
<P><H3><A NAME="HDRREADCBL" HREF="#ToC_12" >Reading a simple Binary EBCDIC file</A></H3>
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> ICobolIOBuilder ioBuilder <font color="#000000"><strong>=</strong></font> JRecordInterface1.COBOL
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">21 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</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">22 </font></span> .<font color="#9966ff">setFont</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">cp037</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">23 </font></span> .<font color="#9966ff">setFileOrganization</font><font color="#000000"><strong>(</strong></font>Constants.IO_FIXED_LENGTH_RECORDS<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">24 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> ioBuilder.<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font>salesFileIn<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">25 </font></span> AbstractLineWriter writer <font color="#000000"><strong>=</strong></font> ioBuilder.<font color="#9966ff">newWriter</font><font color="#000000"><strong>(</strong></font>salesFileOut<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">27 </font></span> <font color="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>saleRecord <font color="#000000"><strong>=</strong></font> reader.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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">28 </font></span> System.out.<font color="#9966ff">print</font><font color="#000000"><strong>(</strong></font>saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">KEYCODE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">29 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">QTY</font><font color="#ff00cc">-</font><font color="#ff00cc">SOLD</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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="#990066">30 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">31 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span> gstExclusive <font color="#000000"><strong>=</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asDouble</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>/</strong></font> GST_CONVERSION;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">33 </font></span> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">set</font><font color="#000000"><strong>(</strong></font>gstExclusive<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">34 </font></span> writer.<font color="#9966ff">write</font><font color="#000000"><strong>(</strong></font>saleRecord<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">35 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">36 </font></span> System.out.<font color="#9966ff">println</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> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">37 </font></span> <font color="#000000"><strong>}</strong></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> reader.<font color="#9966ff">close</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="#990066">40 </font></span> writer.<font color="#9966ff">close</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>
</font></pre>
<P>
<P>
<P><H3><A NAME="Header_13" HREF="#ToC_13" >Reading a Multi-Record Cobol File</A></H3>
<P>To read a multi-Record Cobol file using a Cobol-Copybook like:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 5 </font></span><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066">0</font><font color="#ff0066">1</font><font color="#ff0066"> </font><font color="#ff0066">PO-Record.</font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font>
<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">03</font> Record-Type <font color="#006699"><strong>Pic</strong></font> X(<font color="#ff0000">2</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> Sequence-Number <font color="#006699"><strong>Pic</strong></font> 99v999.
<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">03</font> Vendor <font color="#006699"><strong>Pic</strong></font> <font color="#ff0000">9</font>(<font color="#ff0000">10</font>).
<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">03</font> PO <font color="#006699"><strong>Pic</strong></font> <font color="#ff0000">9</font>(<font color="#ff0000">12</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> ...
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">11 </font></span><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066">0</font><font color="#ff0066">1</font><font color="#ff0066"> </font><font color="#ff0066">Product-Record.</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">03</font> Record-Type <font color="#006699"><strong>pic</strong></font> xx.
<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">03</font> Product <font color="#006699"><strong>Pic</strong></font> <font color="#ff0000">9</font>(<font color="#ff0000">8</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> ...
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">15 </font></span><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066">0</font><font color="#ff0066">1</font><font color="#ff0066"> </font><font color="#ff0066">Location-Record.</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </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> Record-Type <font color="#006699"><strong>pic</strong></font> xx.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </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 <font color="#006699"><strong>occurs</strong></font> <font color="#ff0000">10</font>.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </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> DC-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="#000000">19 </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> Pack-Quantity <font color="#006699"><strong>pic</strong></font> <font color="#ff0000">9</font>(<font color="#ff0000">8</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span>
</font></pre>
<P>
<P>To read a data file with the above 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> AbstractLine l;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">10 </font></span> AbstractLineReader r <font color="#000000"><strong>=</strong></font> JRecordInterface1.COBOL
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">11 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font>copyName<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">12 </font></span> .<font color="#9966ff">setDialect</font><font color="#000000"><strong>(</strong></font>ICopybookDialects.FMT_FUJITSU<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="#9966ff">setSplitCopybook</font><font color="#000000"><strong>(</strong></font>CopybookLoader.SPLIT_01_LEVEL<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span> .<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font>poFile<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">15 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span> <font color="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>l <font color="#000000"><strong>=</strong></font> r.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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">17 </font></span> String id <font color="#000000"><strong>=</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Record</font><font color="#ff00cc">-</font><font color="#ff00cc">Type</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">18 </font></span> <font color="#006699"><strong>if</strong></font> <font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">H1</font><font color="#ff00cc">"</font>.<font color="#9966ff">equals</font><font color="#000000"><strong>(</strong></font>id<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">19 </font></span> System.out.<font color="#9966ff">println</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">PO</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> <font color="#000000"><strong>+</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">PO</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">21 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Vendor</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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> <font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">23 </font></span> <font color="#000000"><strong>}</strong></font> <font color="#006699"><strong>else</strong></font> <font color="#006699"><strong>if</strong></font> <font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">D1</font><font color="#ff00cc">"</font>.<font color="#9966ff">equals</font><font color="#000000"><strong>(</strong></font>id<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> System.out.<font color="#9966ff">println</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">Product</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">25 </font></span> <font color="#000000"><strong>+</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Product</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">26 </font></span> <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="#000000"><strong>+</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Product</font><font color="#ff00cc">-</font><font color="#ff00cc">Name</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">27 </font></span> <font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span> <font color="#000000"><strong>}</strong></font> <font color="#006699"><strong>else</strong></font> <font color="#006699"><strong>if</strong></font> <font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">S1</font><font color="#ff00cc">"</font>.<font color="#9966ff">equals</font><font color="#000000"><strong>(</strong></font>id<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">29 </font></span> System.out.<font color="#9966ff">println</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">Location</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">30 </font></span> <font color="#000000"><strong>+</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DC</font><font color="#ff00cc">-</font><font color="#ff00cc">Number</font><font color="#ff00cc"> </font><font color="#ff00cc">(</font><font color="#ff00cc">1</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">31 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Pack</font><font color="#ff00cc">-</font><font color="#ff00cc">Quantity</font><font color="#ff00cc"> </font><font color="#ff00cc">(</font><font color="#ff00cc">1</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">32 </font></span> <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="#000000"><strong>+</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DC</font><font color="#ff00cc">-</font><font color="#ff00cc">Number</font><font color="#ff00cc"> </font><font color="#ff00cc">(</font><font color="#ff00cc">2</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">33 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> l.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Pack</font><font color="#ff00cc">-</font><font color="#ff00cc">Quantity</font><font color="#ff00cc"> </font><font color="#ff00cc">(</font><font color="#ff00cc">2</font><font color="#ff00cc">)</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">34 </font></span> <font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">35 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">36 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">37 </font></span> r.<font color="#9966ff">close</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>;
</font></pre>
<P>
<P><H3><A NAME="Header_14" HREF="#ToC_14" >Duplicate Field names</A></H3>
<P>In cobol it is possible to have duplicate fields like in the following:
<P>
<pre>
<font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066">0</font><font color="#ff0066">1</font><font color="#ff0066"> </font><font color="#ff0066">COMPANY-RECORD.</font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font><font color="#ff0066"> </font>
<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> COMPANY-NAME <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">30</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> EMPLOYEE-LIST.
<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">10</font> PRESIDENT.
<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">15</font> LAST-NAME <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">15</font>).
<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">15</font> FIRST-NAME <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">8</font>).
<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> VICE-PRESIDENT.
<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">15</font> LAST-NAME <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">15</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">15</font> FIRST-NAME <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">8</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">10</font> OTHERS.
<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">15</font> <font color="#006699"><strong>TITLE</strong></font> <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">10</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">15</font> LAST-NAME <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">15</font>).
<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">15</font> FIRST-NAME <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">8</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </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> <font color="#006699"><strong>ADDRESS</strong></font> <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">15</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </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> CITY <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">15</font>).
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </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> XX.
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </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> ZIP <font color="#006699"><strong>PIC</strong></font> <font color="#ff0000">9</font>(<font color="#ff0000">5</font>) .
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span>
</font></pre>
<P>
<P>You can get the <B>FieldDefinition</B> using the <B>getGroupField</B> method, this <B>FieldDefinition</B> can be used to access field data:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span> IFieldDetail presidentFirstNameFld <font color="#000000"><strong>=</strong></font> record.<font color="#9966ff">getGroupField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">PRESIDENT</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#ff00cc">FIRST</font><font color="#ff00cc">-</font><font color="#ff00cc">NAME</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">20 </font></span> IFieldDetail vicePresidentFirstNameFld <font color="#000000"><strong>=</strong></font> record.<font color="#9966ff">getGroupField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">VICE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRESIDENT</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#ff00cc">FIRST</font><font color="#ff00cc">-</font><font color="#ff00cc">NAME</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">21 </font></span> IFieldDetail otherFirstNameFld <font color="#000000"><strong>=</strong></font> record.<font color="#9966ff">getGroupField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">OTHERS</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#ff00cc">FIRST</font><font color="#ff00cc">-</font><font color="#ff00cc">NAME</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">22 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">23 </font></span> IFieldDetail presidentLastNameFld <font color="#000000"><strong>=</strong></font> record.<font color="#9966ff">getGroupField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">PRESIDENT</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#ff00cc">LAST</font><font color="#ff00cc">-</font><font color="#ff00cc">NAME</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">24 </font></span> IFieldDetail vicePresidentLastNameFld <font color="#000000"><strong>=</strong></font> record.<font color="#9966ff">getGroupField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">VICE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRESIDENT</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#ff00cc">LAST</font><font color="#ff00cc">-</font><font color="#ff00cc">NAME</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">25 </font></span> IFieldDetail otherLastNameFld <font color="#000000"><strong>=</strong></font> record.<font color="#9966ff">getGroupField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">OTHERS</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#ff00cc">LAST</font><font color="#ff00cc">-</font><font color="#ff00cc">NAME</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">26 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">27 </font></span> System.out.<font color="#9966ff">println</font><font color="#000000"><strong>(</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>companyNameFld<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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="#6600cc">\t</font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">29 </font></span> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>presidentFirstNameFld<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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="#6600cc">\t</font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">30 </font></span> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>presidentLastNameFld<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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="#6600cc">\t</font><font color="#ff00cc">|</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">31 </font></span> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>vicePresidentFirstNameFld<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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="#6600cc">\t</font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>vicePresidentLastNameFld<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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="#6600cc">\t</font><font color="#ff00cc">|</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">33 </font></span> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>otherFirstNameFld<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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="#6600cc">\t</font><font color="#ff00cc">"</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">34 </font></span> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>otherLastNameFld<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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="#990066">35 </font></span>
</font></pre>
<P>
<HR><H2><A NAME="Header_15" HREF="#ToC_15" >Csv files</A></H2>
<P>
<P>JRecord can also read / write Csv files. You can use either the column name or field number
to access column.
<P>
<P>
<P><H3><A NAME="Header_16" HREF="#ToC_16" >Reading a CSV file with Names on the first line</A></H3>
<P>The <B>newIOBuilder</B> method has 2 parameters: <I>Field-Seperator</I> and <I>Quote</I>
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">13 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> JRecordInterface1.CSV
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#6600cc">,</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#6600cc">\"</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">15 </font></span>
</font></pre>
<P>
<P>To Read a standard Csv File (Tab seperator, double quote ('"')):
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">13 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> JRecordInterface1.CSV
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#6600cc">\"</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">15 </font></span> .<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font>salesFile<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </font></span> <font color="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>saleRecord <font color="#000000"><strong>=</strong></font> reader.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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">18 </font></span> lineNum <font color="#000000"><strong>+</strong></font><font color="#000000"><strong>=</strong></font> <font color="#ff0000">1</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span> System.out.<font color="#9966ff">println</font><font color="#000000"><strong>(</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">KEYCODE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">21 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Store</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Qty</font><font color="#ff00cc">-</font><font color="#ff00cc">Sold</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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">23 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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> <font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">25 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">27 </font></span> reader.<font color="#9966ff">close</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>;
</font></pre>
<P>
<P>You can also access fields by field number by specifying <B>Record-Number, Column-number</B> in the <B>getFieldValue</B> method:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> JRecordInterface1.CSV
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> .<font color="#9966ff">newIOBuilder</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="#6600cc">\"</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">21 </font></span> .<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font>salesFile<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="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>saleRecord <font color="#000000"><strong>=</strong></font> reader.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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> lineNum <font color="#000000"><strong>+</strong></font><font color="#000000"><strong>=</strong></font> <font color="#ff0000">1</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">25 </font></span> System.out.<font color="#9966ff">println</font><font color="#000000"><strong>(</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff0000">0</font>, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">27 </font></span> <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="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff0000">0</font>, <font color="#ff0000">1</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">28 </font></span> <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="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff0000">0</font>, <font color="#ff0000">4</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">29 </font></span> <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="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff0000">0</font>, <font color="#ff0000">5</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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="#990066">30 </font></span> <font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">31 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span>
</font></pre>
<P>
<P>
<P><H3><A NAME="Header_17" HREF="#ToC_17" >Reading a CSV file with out column names on the first line</A></H3>
<P>To read a CSV file with out Column (or field) names on the first lines, there
are two changes you need to make:
<UL COMPACT>
<LI>Set the file organisation to <B>Constants.IO_UNICODE_TEXT</B>
<LI>Define the columns with the <B>addCsvField</B> method
</UL>
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> JRecordInterface1.CSV
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#6600cc">\"</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">21 </font></span> .<font color="#9966ff">setFileOrganization</font><font color="#000000"><strong>(</strong></font>Constants.IO_UNICODE_TEXT<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">22 </font></span> .<font color="#9966ff">defineFields</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">23 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">KEYCODE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>, Type.ftChar, <font color="#ff0000">0</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> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Store</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">25 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Date</font><font color="#ff00cc">"</font>, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Dept</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">27 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Qty</font><font color="#ff00cc">-</font><font color="#ff00cc">Sold</font><font color="#ff00cc">"</font>, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Sale</font><font color="#ff00cc">-</font><font color="#ff00cc">Price</font><font color="#ff00cc">"</font>, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">29 </font></span> .<font color="#9966ff">endOfRecord</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="#990066">30 </font></span> .<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font>salesFile<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">31 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span> <font color="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>saleRecord <font color="#000000"><strong>=</strong></font> reader.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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">33 </font></span> System.out.<font color="#9966ff">println</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> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">KEYCODE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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="#990066">35 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Store</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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">36 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Qty</font><font color="#ff00cc">-</font><font color="#ff00cc">Sold</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font> .<font color="#9966ff">asString</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">37 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">38 </font></span> <font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">39 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">40 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">41 </font></span> reader.<font color="#9966ff">close</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">42 </font></span>
</font></pre>
<P>
<P><H3><A NAME="Header_18" HREF="#ToC_18" >Reading a Csv with byte delimiter</A></H3>
<P>If you want to read (or write) a CSV file with delimiter like hex-zero (X'00') or x'FF' you can by:
<UL COMPACT>
<LI>Setting the <B>Delimeter</B> to <B>"x'00'"</B> (or what ever) as below.
<LI>Setting the <B>File Organisation</B> to <B>Constants.IO_BIN_NAME_1ST_LINE</B>
or <B>Constants.IO_BIN_TEXT</B> (no Column names).
</UL>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> JRecordInterface1.CSV
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">12 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">x</font><font color="#ff00cc">'</font><font color="#ff00cc">00</font><font color="#ff00cc">'</font><font color="#ff00cc">"</font>, <font color="#ff00cc">"</font><font color="#6600cc">\"</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">12 </font></span> .<font color="#9966ff">setFileOrganization</font><font color="#000000"><strong>(</strong></font>Constants.IO_BIN_NAME_1ST_LINE<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="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font>salesFile<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span>
</font></pre>
<P>
<P><H3><A NAME="Header_19" HREF="#ToC_19" >Writing a Csv File</A></H3>
<P>
<P>When writing a File, you must definar the <B>Column</B> (or fields) but apart from that it is fairly similar to reading a csv :
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span> String FLD_PRICE <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">Price</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">15 </font></span> String FLD_GST <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">GST</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span> String FLD_QTY <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">Qty</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </font></span> String FLD_DEPT <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">Dept</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </font></span> String FLD_DATE <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">Date</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span> String FLD_STORE <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">Store</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> String FLD_SKU <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">Sku</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">21 </font></span>
<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> ICsvIOBuilder outIOBlbdr <font color="#000000"><strong>=</strong></font> JRecordInterface1.CSV
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">24 </font></span> .<font color="#9966ff">newIOBuilder</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="#6600cc">\"</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">25 </font></span> .<font color="#9966ff">defineFields</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">26 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font>FLD_SKU, Type.ftChar, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">27 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font>FLD_STORE, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font>FLD_DATE, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">29 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font>FLD_DEPT, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">30 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font>FLD_QTY, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">31 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font>FLD_PRICE, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span> .<font color="#9966ff">addCsvField</font><font color="#000000"><strong>(</strong></font>FLD_GST, Type.ftNumAnyDecimal, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">33 </font></span> .<font color="#9966ff">endOfRecord</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">34 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">35 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">36 </font></span> outCsvRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>FLD_SKU<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">set</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">37 </font></span> outCsvRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>FLD_STORE<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">set</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">38 </font></span> outCsvRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>FLD_DATE<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">set</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">39 </font></span> outCsvRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>FLD_DEPT<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">set</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="#990066">40 </font></span> outCsvRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>FLD_QTY<font color="#000000"><strong>)</strong></font> .<font color="#9966ff">set</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>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">43 </font></span> writer.<font color="#9966ff">write</font><font color="#000000"><strong>(</strong></font>outCsvRecord<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></pre>
<P>
<P>All the variations mentioned in the <B>Reading Csv</B> sections should work with writing Csv files.
<P>
<HR><H2><A NAME="Header_20" HREF="#ToC_20" >Reading and Writing Fixed Width Files</A></H2>
<P>
<P>Reading and Writing Fixed width Files is very similar to Reading and Writing Csv files.
<P>
<P><H3><A NAME="Header_21" HREF="#ToC_21" >Defining a file by Field-Lengths</A></H3>
<P>
<P>You can define the <I>Record Layout</I> by the lengths of the fields using the <B>defineFieldsByLength</B> and <B>addFieldByLength</B> methods:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> JRecordInterface1.FIXED_WIDTH.<font color="#9966ff">newIOBuilder</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="#990066">15 </font></span> .<font color="#9966ff">defineFieldsByLength</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">16 </font></span> .<font color="#9966ff">addFieldByLength</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Sku</font><font color="#ff00cc">"</font> , Type.ftChar, <font color="#ff0000">8</font>, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </font></span> .<font color="#9966ff">addFieldByLength</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Store</font><font color="#ff00cc">"</font>, Type.ftNumRightJustified, <font color="#ff0000">3</font>, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </font></span> .<font color="#9966ff">addFieldByLength</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Date</font><font color="#ff00cc">"</font> , Type.ftNumRightJustified, <font color="#ff0000">6</font>, <font color="#ff0000">0</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> .<font color="#9966ff">addFieldByLength</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Dept</font><font color="#ff00cc">"</font> , Type.ftNumRightJustified, <font color="#ff0000">3</font>, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> .<font color="#9966ff">addFieldByLength</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Qty</font><font color="#ff00cc">"</font> , Type.ftNumRightJustified, <font color="#ff0000">2</font>, <font color="#ff0000">0</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="#9966ff">addFieldByLength</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Price</font><font color="#ff00cc">"</font>, Type.ftNumRightJustified, <font color="#ff0000">6</font>, <font color="#ff0000">2</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> .<font color="#9966ff">endOfRecord</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">23 </font></span> .<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font><font color="#cc00cc">this</font>.<font color="#9966ff">getClass</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">getResource</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020_tst1</font><font color="#ff00cc">.</font><font color="#ff00cc">bin</font><font color="#ff00cc">.</font><font color="#ff00cc">txt</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">getFile</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> AbstractLine saleRecord;
<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 color="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>saleRecord <font color="#000000"><strong>=</strong></font> reader.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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">27 </font></span> System.out.<font color="#9966ff">println</font><font color="#000000"><strong>(</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Sku</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">29 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Store</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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="#990066">30 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Date</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">31 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Dept</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">32 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Qty</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">33 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Price</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">34 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">35 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">36 </font></span> reader.<font color="#9966ff">close</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">37 </font></span>
</font></pre>
<P>
<P>
<P><H3><A NAME="Header_22" HREF="#ToC_22" >Defining a file by Field-Positions</A></H3>
<P>
<P>You can define the <I>Record Layout</I> by the Position of the fields using the <B>defineFieldsByPosition</B> and <B>addFieldByPosition</B> methods:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">11 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> JRecordInterface1.FIXED_WIDTH.<font color="#9966ff">newIOBuilder</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">12 </font></span> .<font color="#9966ff">defineFieldsByPosition</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">13 </font></span> .<font color="#9966ff">addFieldByPosition</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Sku</font><font color="#ff00cc">"</font> , Type.ftChar , <font color="#ff0000">1</font>, <font color="#ff0000">0</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> .<font color="#9966ff">addFieldByPosition</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Store</font><font color="#ff00cc">"</font>, Type.ftNumRightJustified, <font color="#ff0000">9</font>, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">15 </font></span> .<font color="#9966ff">addFieldByPosition</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Date</font><font color="#ff00cc">"</font> , Type.ftNumRightJustified, <font color="#ff0000">12</font>, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span> .<font color="#9966ff">addFieldByPosition</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Dept</font><font color="#ff00cc">"</font> , Type.ftNumRightJustified, <font color="#ff0000">18</font>, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </font></span> .<font color="#9966ff">addFieldByPosition</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Qty</font><font color="#ff00cc">"</font> , Type.ftNumRightJustified, <font color="#ff0000">21</font>, <font color="#ff0000">0</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </font></span> .<font color="#9966ff">addFieldByPosition</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Price</font><font color="#ff00cc">"</font>, Type.ftNumRightJustified, <font color="#ff0000">23</font>, <font color="#ff0000">2</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> .<font color="#9966ff">endOfRecord</font><font color="#000000"><strong>(</strong></font><font color="#ff0000">29</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> .<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font><font color="#cc00cc">this</font>.<font color="#9966ff">getClass</font><font color="#000000"><strong>(</strong></font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">getResource</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020_tst1</font><font color="#ff00cc">.</font><font color="#ff00cc">bin</font><font color="#ff00cc">.</font><font color="#ff00cc">txt</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">getFile</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">21 </font></span> AbstractLine saleRecord;
<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="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>saleRecord <font color="#000000"><strong>=</strong></font> reader.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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> System.out.<font color="#9966ff">println</font><font color="#000000"><strong>(</strong></font>saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Sku</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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="#990066">25 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Qty</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">26 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> saleRecord.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">Price</font><font color="#ff00cc">"</font><font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">27 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">29 </font></span> reader.<font color="#9966ff">close</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="#990066">30 </font></span>
</font></pre>
<P>
<P>
<HR><H2><A NAME="HDRXMLSCHEMA" HREF="#ToC_23" >Xml Schema</A></H2>
<P>In JRecord, you can also use a <B>Xml Schema</B> instead of a Cobol Copybook to define
a file.
<P>A sample <B>Fixed-Width</B> Xml schema:
<P>
<pre><font color="#000000"><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">RECORD</font><font color="#0000ff"> </font><font color="#0000ff">RECORDNAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">COPYBOOK</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">DELIMITER</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#cc00cc">&</font><font color="#cc00cc">lt</font><font color="#cc00cc">;</font><font color="#ff00cc">Tab</font><font color="#cc00cc">&</font><font color="#cc00cc">gt</font><font color="#cc00cc">;</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"> </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">FONTNAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">CP037</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">FILESTRUCTURE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Default</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">STYLE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">0</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">RECORDTYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">RecordLayout</font><font color="#ff00cc">"</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">LIST</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Y</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">QUOTE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">RecSep</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">default</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">FIELDS</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">KEYCODE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</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"> </font><font color="#0000ff">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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Char</font><font color="#ff00cc">"</font><font color="#0000ff"> </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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">STORE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</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">9</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff"> </font><font color="#0000ff">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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Mainframe</font><font color="#ff00cc"> </font><font color="#ff00cc">Packed</font><font color="#ff00cc"> </font><font color="#ff00cc">Decimal</font><font color="#ff00cc"> </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="#ff00cc">"</font><font color="#0000ff"> </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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">DATE</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">POSITION</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">11</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Mainframe</font><font color="#ff00cc"> </font><font color="#ff00cc">Packed</font><font color="#ff00cc"> </font><font color="#ff00cc">Decimal</font><font color="#ff00cc"> </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="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">/</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">DEPT</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</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">15</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Mainframe</font><font color="#ff00cc"> </font><font color="#ff00cc">Packed</font><font color="#ff00cc"> </font><font color="#ff00cc">Decimal</font><font color="#ff00cc"> </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="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">/</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">QTY</font><font color="#ff00cc">-</font><font color="#ff00cc">SOLD</font><font color="#ff00cc">"</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">17</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Mainframe</font><font color="#ff00cc"> </font><font color="#ff00cc">Packed</font><font color="#ff00cc"> </font><font color="#ff00cc">Decimal</font><font color="#ff00cc"> </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="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">/</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</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">22</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">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">DECIMAL</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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Mainframe</font><font color="#ff00cc"> </font><font color="#ff00cc">Packed</font><font color="#ff00cc"> </font><font color="#ff00cc">Decimal</font><font color="#ff00cc"> </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="#ff00cc">"</font><font color="#0000ff"> </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">/</font><font color="#0000ff">FIELDS</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">/</font><font color="#0000ff">RECORD</font><font color="#0000ff">></font>
</font></pre>
<P>
<P>You can define a <B>Csv Xml-Schema</B>:
<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="#0099ff"><strong><?</strong></font><font color="#0099ff"><strong>xml</strong></font><font color="#0099ff"><strong> </strong></font><font color="#0099ff"><strong>version="1.0"</strong></font><font color="#0099ff"><strong> </strong></font><font color="#0099ff"><strong>encoding="UTF-8"?</strong></font><font color="#0099ff"><strong>></strong></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">RECORD</font><font color="#0000ff"> </font><font color="#0000ff">RECORDNAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">COPYBOOK</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">DELIMITER</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">;</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">FILESTRUCTURE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">CSV_NAME_1ST_LINE</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">STYLE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">0</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">RECORDTYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Delimited</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">LIST</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">N</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">QUOTE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#cc00cc">&</font><font color="#cc00cc">quot</font><font color="#cc00cc">;</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">RecSep</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">default</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">LINE_NO_FIELD_NAMES</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">1</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">FIELDS</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Sku</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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Char</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Store</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">2</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">NumAnyDecimal</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Date</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">3</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">NumAnyDecimal</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Dept</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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">NumAnyDecimal</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">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Qty</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">5</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">NumAnyDecimal</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"> 9 </font></span> <font color="#0000ff"><</font><font color="#0000ff">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">Price</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">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">NumAnyDecimal</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"> 10 </font></span> <font color="#0000ff"><</font><font color="#0000ff">FIELD</font><font color="#0000ff"> </font><font color="#0000ff">NAME</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">GST</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">7</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">TYPE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">NumAnyDecimal</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"> 11 </font></span> <font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">FIELDS</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">/</font><font color="#0000ff">RECORD</font><font color="#0000ff">></font>
</font></pre>
<P>
<P>You then use <font color="blue"><b>JRecordInterface1.SCHEMA_XML</b></font> to create an <B>IOBuilder</B> from an Xml-Schema:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">5 </font></span> IIOBuilder ioBldr <font color="#000000"><strong>=</strong></font> JRecordInterface1.SCHEMA_XML
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">6 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font>copybookName<font color="#000000"><strong>)</strong></font>;
</font></pre>
<P>
<P>You then create readers / writers as you would with <I>Cobol IOBuilder</I>. Using the <I>Xml-IOBuilder</I> to create readers/writers is exactly the
same as with a <I>Cobol IOBuilder</I>. See <A HREF="#HDRREADCBL">"Reading a simple Binary EBCDIC file"</A> for examples of using a <I>Cobol IOBuilder</I>
<P>
<HR><H2><A NAME="Header_24" HREF="#ToC_24" >RecordEditor</A></H2>
<P>The <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a>
is useful several ways to JRecord users:
<UL COMPACT>
<LI>Can Edit / compare your Cobol data files.
<LI>For files without Cobol-Copybooks, The <B>RecordEditors</B>
<a href="Docs/RecordEditor_Wizard.htm">File-Wizard</a>
can guide you through creating Schema that can then be Exported as an Xml schema that can be used in JRecord. See <A HREF="#HDRXMLSCHEMA">"Xml Schema"</A> for details.
<LI>The Cobol Copybook import lets yo "try" out the parameters and generate a JRecord IOBuilder.
</UL>
<P>
<P><H3><A NAME="Header_25" HREF="#ToC_25" >RecordEditor Code Generation</A></H3>
<P>Version 0.98 of the <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> introduced Code-Generation in 2 area's
<OL TYPE=1>
<P><LI>When editing simple Fixed-Width / Csv Files you can Generate Java~JRecord code
using the <B>Generate >>> Java</B>. See <A HREF="#HDRGEN4EDIT">"Generate when Editing"</A>
<P><LI>You can generate Java~JRecord code for a Cobol copybook
with the <B>Generate >>> Java~JRecord code for Cobol</B>
</OL>
<P>The
<a href="RecordEditorGenerate.htm">RecordEditor Generate documentation</a>
contains a detailed description of the Generate function.
<P>
<P><H4><A NAME="HDRGEN4EDIT">Generate when Editing</A></H4>
<P>When editing a simple file in the <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a>, you can generate Java~JRecord code
to read/write the file:
<P>
<img SRC="Diagram/FileGen01.png">
<P>
<P> <P>
<P>Then the generated Java code is displayed:
<P>
<img SRC="Diagram/FileGen03.png">
<P>
<P><H4><A NAME="Header_27">Generate Java JRecord code for Cobol Copybooks</A></H4>
<P>In the <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> you can also generate Java~JRecord Code to read/write
cobol data files. Select <B>Generate >>> Java~JRecord code for Cobol</B>:
<P>
<img SRC="Diagram/CobolGen01.png">
<P>
<P>Then enter the Cobol copybook (+ optionally a sample file, The <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a>
will use the sample file to fill in some of the attributes):
<P>
<img SRC="Diagram/CobolGen02.png">
<P>
<P>There is more details in
<a href="RecordEditorGenerate.htm">RecordEditor Generate documentation</a>
<P>
<P><H3><A NAME="HDRCBLIMPORT" HREF="#ToC_28" >RecordEditor Cobol Import</A></H3>
<P>
<img SRC="Diagram/CobolImport00.png">
<P>
<P>When you Import a Cobol copybook into the <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> and specify a sample file:
<UL>
<P><LI>The <b>RecordEditor</b> will read the file and try to work out the appropriate attributes:.
<P><LI>The <b>RecordEditor</b> will display the file using the selected attributes, allowing you to
try out the varous attributes.
<P><LI>As well as importing the copybook in to the RecordEditor, you can also generate
a <B>JRecord IOBuilder</B> for the file using the attributes selected.
</UL>
<P>
<img SRC="Diagram/CobolImport01.png">
<P>
<P>All the options on the screen correspond to a JRecord-CobolIOBuilder set* method,
most are obvious:
<P>
<BR>
<TABLE BORDER="1">
<TR>
<TH ALIGN="LEFT" VALIGN="TOP" BGCOLOR="#DADADA" WIDTH="50%">Screen Attribute
</TH><TH ALIGN="LEFT" VALIGN="TOP" BGCOLOR="#DADADA" WIDTH="50%">Method
</TH></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">Cobol Line Format
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">setCopybookFileFormat
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">Split Copybook
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">setSplitCopybook
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">Font Name
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">setFont
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">Cobol Dialect
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">setDialect
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">File Structure
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">setFileOrganization
</TD></TR></TABLE>
<P>
<P>For <I>File Structure</I> ~ <I>setFileOrganization</I> the possible values are:
<P>
<P>For the above example, pressing the <B>Generate JRecord Code</B> button will generate:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span> ICobolIOBuilder iob <font color="#000000"><strong>=</strong></font> JRecordInterface1.COBOL
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">G</font><font color="#ff00cc">:</font><font color="#ff00cc">\</font><font color="#ff00cc">Users</font><font color="#ff00cc">\</font><font color="#ff00cc">Bruce01</font><font color="#6600cc">\R</font><font color="#ff00cc">ecordEditor_HSQL</font><font color="#ff00cc">\</font><font color="#ff00cc">CopyBook</font><font color="#ff00cc">\</font><font color="#ff00cc">Cobol</font><font color="#ff00cc">\</font><font color="#ff00cc">DTAR020</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"> 4 </font></span> .<font color="#9966ff">setFont</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">cp037</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"> 5 </font></span> AbstractLine line;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 6 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 7 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 8 </font></span><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">AbstractLineReader</font><font color="#ff8400"> </font><font color="#ff8400">reader</font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400">=</font><font color="#ff8400"> </font><font color="#ff8400">iob.newReader("G:\Users\Bruce01\RecordEditor_HSQL\SampleFiles\DTAR020.bin");</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 9 </font></span><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">while</font><font color="#ff8400"> </font><font color="#ff8400">((line</font><font color="#ff8400"> </font><font color="#ff8400">=</font><font color="#ff8400"> </font><font color="#ff8400">reader.read())</font><font color="#ff8400"> </font><font color="#ff8400">!=</font><font color="#ff8400"> </font><font color="#ff8400">null)</font><font color="#ff8400"> </font><font color="#ff8400">{}</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">10 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">11 </font></span><font color="#ff8400">//</font><font color="#ff8400"> </font><font color="#ff8400">or</font><font color="#ff8400"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">12 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">13 </font></span><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">AbstractLineWriter</font><font color="#ff8400"> </font><font color="#ff8400">writer</font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400">=</font><font color="#ff8400"> </font><font color="#ff8400">iob.newWriter("G:\Users\Bruce01\RecordEditor_HSQL\SampleFiles\DTAR020.bin");</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span><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">line</font><font color="#ff8400"> </font><font color="#ff8400">=</font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400">iob.newLine();</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">15 </font></span><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">line.getFieldValue("...").set(...);</font>
</font></pre>
<P>
<P>The Cobol-Import will display the file using the attributes selected. This allows you to check
everything is ok:
<P>
<img SRC="Diagram/CobolImport02.png">
<P>
<P>Finally for Multi-Record files you can select a "Selection Field" + selection values:
<P>
<P>
<img SRC="Diagram/CobolImport03.png">
<P>
<P><H3><A NAME="HDRREGENJR" HREF="#ToC_29" >Generate JRecord code</A></H3>
<P>The Cobol Import screen will try and determine the attributes using the Copybook and a sample file.
You can play around with the attributes and check the results in the File preview screen.
When happy, you can generate basic JRecord IOBuilder code.
<P>
<img SRC="Diagram/CobolImport01.png">
<P>
<P>When you press the <B>Generate JRecord Code</B> button will generates 2 bits of source code,
the first has a basic code to create an IOBuilder:
<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="#cc0000">/*</font><font color="#cc0000">----------------</font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000">Required</font><font color="#cc0000"> </font><font color="#cc0000">Imports</font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000">----------------------</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 2 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 3 </font></span><font color="#cc0000">import</font><font color="#cc0000"> </font><font color="#cc0000">net.sf.JRecord.JRecordInterface1;</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 4 </font></span><font color="#cc0000">import</font><font color="#cc0000"> </font><font color="#cc0000">net.sf.JRecord.Details.AbstractLine;</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 5 </font></span><font color="#cc0000">import</font><font color="#cc0000"> </font><font color="#cc0000">net.sf.JRecord.IO.AbstractLineReader;</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 6 </font></span><font color="#cc0000">import</font><font color="#cc0000"> </font><font color="#cc0000">net.sf.JRecord.def.IO.builders.ICobolIOBuilder;</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 7 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 8 </font></span><font color="#cc0000"> </font><font color="#cc0000">*----------------------------------------------------------</font><font color="#cc0000">*/</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 9 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 10 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 11 </font></span> ICobolIOBuilder iob <font color="#000000"><strong>=</strong></font> JRecordInterface1.COBOL
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 12 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">G</font><font color="#ff00cc">:</font><font color="#ff00cc">/</font><font color="#ff00cc">Users</font><font color="#ff00cc">/</font><font color="#ff00cc">Bruce01</font><font color="#ff00cc">/</font><font color="#ff00cc">RecordEditor_HSQL</font><font color="#ff00cc">/</font><font color="#ff00cc">CopyBook</font><font color="#ff00cc">/</font><font color="#ff00cc">Cobol</font><font color="#ff00cc">/</font><font color="#ff00cc">DTAR020</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"> 13 </font></span> .<font color="#9966ff">setFont</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">cp037</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"> 14 </font></span> AbstractLine line;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066"> 15 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 16 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 17 </font></span><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">AbstractLineReader</font><font color="#ff8400"> </font><font color="#ff8400">reader</font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400">=</font><font color="#ff8400"> </font><font color="#ff8400">iob.newReader("G:/Users/Bruce01/RecordEditor_HSQL/SampleFiles/DTAR020.bin");</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 18 </font></span><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">while</font><font color="#ff8400"> </font><font color="#ff8400">((line</font><font color="#ff8400"> </font><font color="#ff8400">=</font><font color="#ff8400"> </font><font color="#ff8400">reader.read())</font><font color="#ff8400"> </font><font color="#ff8400">!=</font><font color="#ff8400"> </font><font color="#ff8400">null)</font><font color="#ff8400"> </font><font color="#ff8400">{}</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><font color="#ff8400">//</font><font color="#ff8400"> </font><font color="#ff8400">or</font><font color="#ff8400"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 21 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 22 </font></span><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">AbstractLineWriter</font><font color="#ff8400"> </font><font color="#ff8400">writer</font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400">=</font><font color="#ff8400"> </font><font color="#ff8400">iob.newWriter("G:/Users/Bruce01/RecordEditor_HSQL/SampleFiles/DTAR020.bin");</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 23 </font></span><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">line</font><font color="#ff8400"> </font><font color="#ff8400">=</font><font color="#ff8400"> </font><font color="#ff8400"> </font><font color="#ff8400">iob.newLine();</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000"> 24 </font></span><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">line.getFieldValue("...").set(...);</font>
</font></pre>
<P>
<P>The second holds <I>Cobol-Field-Name</I> constants:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">11 </font></span><font color="#009966"><strong>public</strong></font> <font color="#0099ff"><strong>class</strong></font> Dtar020 <font color="#000000"><strong>{</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">12 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">13 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>static</strong></font> <font color="#009966"><strong>final</strong></font> ClassDtar020 DTAR020 <font color="#000000"><strong>=</strong></font> <font color="#006699"><strong>new</strong></font> <font color="#9966ff">ClassDtar020</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>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>static</strong></font> <font color="#009966"><strong>final</strong></font> <font color="#0099ff"><strong>class</strong></font> ClassDtar020 <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="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String recordName <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">"</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> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String keycodeNo <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">KEYCODE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">21 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String storeNo <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">STORE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">22 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String date <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">DATE</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">23 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String deptNo <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">DEPT</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">24 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String qtySold <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">QTY</font><font color="#ff00cc">-</font><font color="#ff00cc">SOLD</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">25 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String salePrice <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">-</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">27 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span><font color="#000000"><strong>}</strong></font>
</font></pre>
<P>
<P>You can then use the <I>Cobol-Field-Name</I> constants in Code-Completion in your favourite IDE. Following is
an example using a generated constant file:
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span> AbstractLine line;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span> Dtar020.ClassDtar020 dtar020 <font color="#000000"><strong>=</strong></font> Dtar020.DTAR020;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">21 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">22 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> iob.<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">G</font><font color="#ff00cc">:</font><font color="#6600cc">\\</font><font color="#ff00cc">Users</font><font color="#6600cc">\\</font><font color="#ff00cc">Bruce01</font><font color="#6600cc">\\</font><font color="#ff00cc">RecordEditor_HSQL</font><font color="#6600cc">\\</font><font color="#ff00cc">SampleFiles</font><font color="#6600cc">\\</font><font color="#ff00cc">DTAR020</font><font color="#ff00cc">.</font><font color="#ff00cc">bin</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">23 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">24 </font></span> <font color="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>line <font color="#000000"><strong>=</strong></font> reader.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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="#990066">25 </font></span> System.out.<font color="#9966ff">println</font><font color="#000000"><strong>(</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>dtar020.keycodeNo<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">27 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>dtar020.deptNo<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">28 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>dtar020.qtySold<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">29 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#6600cc">\t</font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>dtar020.salePrice<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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="#990066">30 </font></span> <font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">31 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span>
</font></pre>
<P>
<P><H3><A NAME="Header_30" HREF="#ToC_30" >Cobol Copybok Display</A></H3>
<P>The <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> can display a Cobol-Copybook in a Tree Display
<P>
<img SRC="Diagram/RE_CobolCopybook.png">
<P>
<P><H3><A NAME="Header_31" HREF="#ToC_31" >File Compare</A></H3>
<P>The <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> can compare 2 files using a Cobol-Copybook and show you
which fields are different. Below the fields where there a differences are in Lime-Grren; Deleted lines
are aqua and inserted lines yellow.
<P>
<img SRC="Diagram/RE_Compare.png">
<P>
<HR><H2><A NAME="HDRCODEGEN" HREF="#ToC_32" >JRecord Code Generation</A></H2>
<P>JRecord has a basic <B>Code Generator</B>. It takes a <B>Cobol</B> Copybook
and generates skelton <font color="blue">Java~JRecord</font> code to read/write. It is available at:
<P>
<p><a href="https://sourceforge.net/projects/jrecord/files/jrecord_CodeGen/">https://sourceforge.net/projects/jrecord/files/jrecord_CodeGen/</a>
<P>
<P>The following <B>CodeGen</B> examples all refer to this <B>Cobol Copybook</B>:
<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="#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> DTAR020-KCODE-STORE-KEY.
<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">05</font> DTAR020-KEYCODE-NO <font color="#006699"><strong>PIC</strong></font> X(<font color="#ff0000">08</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">05</font> DTAR020-STORE-NO <font color="#006699"><strong>PIC</strong></font> S9(<font color="#ff0000">03</font>) <font color="#006699"><strong>COMP-3</strong></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">03</font> DTAR020-DATE <font color="#006699"><strong>PIC</strong></font> S9(<font color="#ff0000">07</font>) <font color="#006699"><strong>COMP-3</strong></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">03</font> DTAR020-DEPT-NO <font color="#006699"><strong>PIC</strong></font> S9(<font color="#ff0000">03</font>) <font color="#006699"><strong>COMP-3</strong></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">03</font> DTAR020-QTY-SOLD <font color="#006699"><strong>PIC</strong></font> S9(<font color="#ff0000">9</font>) <font color="#006699"><strong>COMP-3</strong></font>.
<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> DTAR020-SALE-PRICE <font color="#006699"><strong>PIC</strong></font> S9(<font color="#ff0000">9</font>)V99 <font color="#006699"><strong>COMP-3</strong></font>.
</font></pre>
<P>
<P>To call <B>CodeGen</B> in a bat file:
<pre>
<P>
java -jar ../../lib/JRecordCodeGen.jar ^
<font color=blue> -Template standard</font> ^
-package example.ioBuilder.dtar020 ^
-Schema DTAR020.cbl ^
-FileOrganisation FixedWidth ^
-font cp037 ^
-DropCopybookName true ^
-outputDirectory DTAR020
</pre>
<P>
<P>This will generate a <font color="blue">Cobol-Field-name</font> class, skelton <font color="blue">Read</font> class and a skelton <font color="blue">write</font> class.
The generated <B>FieldName</B> class is
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span><font color="#009966"><strong>public</strong></font> <font color="#0099ff"><strong>class</strong></font> FieldNamesDtar020 <font color="#000000"><strong>{</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">33 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">34 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>static</strong></font> <font color="#009966"><strong>final</strong></font> RecordDtar020 RECORD_DTAR020 <font color="#000000"><strong>=</strong></font> <font color="#006699"><strong>new</strong></font> <font color="#9966ff">RecordDtar020</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="#990066">35 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">36 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>static</strong></font> <font color="#0099ff"><strong>class</strong></font> RecordDtar020 <font color="#000000"><strong>{</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">37 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String keycodeNo <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">KEYCODE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">38 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String storeNo <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">STORE</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">39 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String date <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DATE</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">40 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String deptNo <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">DEPT</font><font color="#ff00cc">-</font><font color="#ff00cc">NO</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">41 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String qtySold <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">QTY</font><font color="#ff00cc">-</font><font color="#ff00cc">SOLD</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">42 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> String salePrice <font color="#000000"><strong>=</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc">SALE</font><font color="#ff00cc">-</font><font color="#ff00cc">PRICE</font><font color="#ff00cc">"</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">43 </font></span> <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="#000000"><strong>}</strong></font>
</font></pre>
<P>
<P>The generated <B>read</B> code is
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">60 </font></span> AbstractLine line;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">61 </font></span> <font color="#0099ff"><strong>int</strong></font> lineNum <font color="#000000"><strong>=</strong></font> <font color="#ff0000">0</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">62 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">63 </font></span> <font color="#006699"><strong>try</strong></font> <font color="#000000"><strong>{</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">64 </font></span> ICobolIOBuilder iob <font color="#000000"><strong>=</strong></font> JRecordInterface1.COBOL
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">65 </font></span> .<font color="#9966ff">newIOBuilder</font><font color="#000000"><strong>(</strong></font>copybookName<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">66 </font></span> .<font color="#9966ff">setFont</font><font color="#000000"><strong>(</strong></font><font color="#ff00cc">"</font><font color="#ff00cc">CP037</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">67 </font></span> .<font color="#9966ff">setFileOrganization</font><font color="#000000"><strong>(</strong></font>Constants.IO_FIXED_LENGTH<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">68 </font></span> .<font color="#9966ff">setSplitCopybook</font><font color="#000000"><strong>(</strong></font>CopybookLoader.SPLIT_NONE<font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">69 </font></span> .<font color="#9966ff">setDropCopybookNameFromFields</font><font color="#000000"><strong>(</strong></font><font color="#cc00cc">true</font><font color="#000000"><strong>)</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">70 </font></span> ;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">71 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">72 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">73 </font></span> FieldNamesDtar020.RecordDtar020 rDtar020 <font color="#000000"><strong>=</strong></font> FieldNamesDtar020.RECORD_DTAR020;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">74 </font></span> AbstractLineReader reader <font color="#000000"><strong>=</strong></font> iob.<font color="#9966ff">newReader</font><font color="#000000"><strong>(</strong></font>salesFile<font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">75 </font></span> <font color="#006699"><strong>while</strong></font> <font color="#000000"><strong>(</strong></font><font color="#000000"><strong>(</strong></font>line <font color="#000000"><strong>=</strong></font> reader.<font color="#9966ff">read</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="#000000"><strong>=</strong></font> <font color="#cc00cc">null</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">76 </font></span> lineNum <font color="#000000"><strong>+</strong></font><font color="#000000"><strong>=</strong></font> <font color="#ff0000">1</font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">77 </font></span> System.out.<font color="#9966ff">println</font><font color="#000000"><strong>(</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">78 </font></span> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>rDtar020.keycodeNo<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">79 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>rDtar020.storeNo<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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="#990066">80 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>rDtar020.date<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">81 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>rDtar020.deptNo<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">82 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>rDtar020.qtySold<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">83 </font></span> <font color="#000000"><strong>+</strong></font> <font color="#ff00cc">"</font><font color="#ff00cc"> </font><font color="#ff00cc">"</font> <font color="#000000"><strong>+</strong></font> line.<font color="#9966ff">getFieldValue</font><font color="#000000"><strong>(</strong></font>rDtar020.salePrice<font color="#000000"><strong>)</strong></font>.<font color="#9966ff">asString</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">84 </font></span> <font color="#000000"><strong>)</strong></font>;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">85 </font></span> <font color="#000000"><strong>}</strong></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">86 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">87 </font></span> reader.<font color="#9966ff">close</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">88 </font></span> <font color="#000000"><strong>}</strong></font> <font color="#006699"><strong>catch</strong></font> <font color="#000000"><strong>(</strong></font>Exception e<font color="#000000"><strong>)</strong></font> <font color="#000000"><strong>{</strong></font>
</font></pre>
<P>
<P>
<P><H3><A NAME="HDRUSECODEGEN" HREF="#ToC_33" >Uses of CodeGen code</A></H3>
If you want to do your own Code generation
or need more "Cobol" schema details, some of classes might be useful:
<TABLE CELLPADDING="3">
<TR VALIGN="TOP"><TD><P><B>CCode </B></TD><TD><P>Holds methods to convert Type-code, IO-codes etc back in to JRecord constants. Full class name: net.sf.JRecord.cg.common.CCode
</TD></TR><TR VALIGN="TOP"><TD><P><B>LayoutDef </B></TD><TD><P>Build an extended-schema with extra fields (like java class etc). Full class name: net.sf.JRecord.cg.schema.LayoutDef
</TD></TR></TABLE>
<P><B>Note: </B>The source is available in the
<B>Source/Other_Source/Code_Gen</B>.
<P>
<HR><H2><A NAME="HDRITEMSCHEMA" HREF="#ToC_34" >Cobol Item Schema Details</A></H2>
There are 2 "Extended Schema" classes available:
<TABLE CELLPADDING="3">
<TR VALIGN="TOP"><TD><P><B>CobolSchemaReader </B></TD><TD><P>This returns details a JRecord details and the full Cobol-Item tree. See <A HREF="#HDRCBLSR">"CobolSchemaReader"</A> for details.
</TD></TR><TR VALIGN="TOP"><TD><P><B>LayoutDef </B></TD><TD><P>Holds extra details like java-type etc. It is for Code-Generation. See <A HREF="#HDRUSECODEGEN">"Uses of CodeGen code"</A> for details.
</TD></TR></TABLE>
<P>
<P><H3><A NAME="HDRCBLSR" HREF="#ToC_35" >CobolSchemaReader</A></H3>
There is a <I>Extended Cobol Scema load class</I> <B>net.sf.JRecord.schema.CobolSchemaReader</B>.
This is basically a "builder like" class similar to the CobolIOBuilder. The <B>getCobolSchemaDetails()</B>
method returns the class <B>CobolSchemaDetails</B>:
<P>
<P>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">13 </font></span><font color="#6600cc">/**</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">14 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc">Class</font><font color="#6600cc"> </font><font color="#6600cc">Holds</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">ul</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="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">li</font><font color="#0000ff">></font><font color="#6600cc">JRecord</font><font color="#6600cc"> </font><font color="#6600cc">schema</font><font color="#6600cc"> </font><font color="#6600cc">(</font><font color="#6600cc">LayoutDetail</font><font color="#6600cc">)</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">16 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">li</font><font color="#0000ff">></font><font color="#ff00cc">"</font><font color="#ff00cc">Cobol</font><font color="#ff00cc"> </font><font color="#ff00cc">Item</font><font color="#ff00cc"> </font><font color="#ff00cc">Tree</font><font color="#ff00cc">"</font><font color="#6600cc"> </font><font color="#6600cc">for</font><font color="#6600cc"> </font><font color="#6600cc">each</font><font color="#6600cc"> </font><font color="#6600cc">Record</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">17 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">li</font><font color="#0000ff">></font><font color="#ff00cc">"</font><font color="#ff00cc">Cobol</font><font color="#ff00cc"> </font><font color="#ff00cc">Copybook</font><font color="#ff00cc"> </font><font color="#ff00cc">definition</font><font color="#ff00cc"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">18 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">li</font><font color="#0000ff">></font><font color="#6600cc">An</font><font color="#6600cc"> </font><font color="#6600cc">IOBuilder</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">19 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">li</font><font color="#0000ff">></font><font color="#6600cc">General</font><font color="#6600cc"> </font><font color="#6600cc">Copybook</font><font color="#6600cc"> </font><font color="#6600cc">Information</font><font color="#6600cc"> </font><font color="#6600cc"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">20 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">21 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#02b902">@author</font><font color="#6600cc"> </font><font color="#6600cc">Bruce</font><font color="#6600cc"> </font><font color="#6600cc">Martin</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">22 </font></span><font color="#6600cc"> </font><font color="#6600cc">*</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">23 </font></span><font color="#6600cc"> </font><font color="#6600cc">*/</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">24 </font></span><font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> <font color="#0099ff"><strong>class</strong></font> CobolSchemaDetails <font color="#000000"><strong>{</strong></font>
<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 color="#6600cc">/**</font><font color="#6600cc"> </font><font color="#6600cc">Standard</font><font color="#6600cc"> </font><font color="#6600cc">JRecord</font><font color="#6600cc"> </font><font color="#6600cc">schema</font><font color="#6600cc"> </font><font color="#6600cc">*/</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">27 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> LayoutDetail schema;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">28 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">29 </font></span> <font color="#6600cc">/**</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">30 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc">Holds</font><font color="#6600cc"> </font><font color="#6600cc">a</font><font color="#6600cc"> </font><font color="#6600cc">list</font><font color="#6600cc"> </font><font color="#6600cc">of</font><font color="#6600cc"> </font><font color="#6600cc">Cobol</font><font color="#6600cc">-</font><font color="#6600cc">Item</font><font color="#6600cc">-</font><font color="#6600cc">Tree</font><font color="#6600cc">'</font><font color="#6600cc">s</font><font color="#6600cc"> </font><font color="#6600cc">one</font><font color="#6600cc"> </font><font color="#6600cc">for</font><font color="#6600cc"> </font><font color="#6600cc">each</font><font color="#6600cc"> </font><font color="#6600cc">record</font><font color="#6600cc"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">31 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc">in</font><font color="#6600cc"> </font><font color="#6600cc">the</font><font color="#6600cc"> </font><font color="#6600cc">JRecord</font><font color="#6600cc">-</font><font color="#6600cc">Schema</font><font color="#6600cc"> </font><font color="#6600cc">(</font><font color="#6600cc">LayoutDetail</font><font color="#6600cc">)</font><font color="#6600cc">.</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">32 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc">Each</font><font color="#6600cc"> </font><font color="#ff00cc">"</font><font color="#ff00cc">Item</font><font color="#ff00cc">"</font><font color="#6600cc"> </font><font color="#6600cc">holds</font><font color="#6600cc"> </font><font color="#6600cc">the</font><font color="#6600cc"> </font><font color="#6600cc">Cobol</font><font color="#6600cc">-</font><font color="#6600cc">Field</font><font color="#6600cc"> </font><font color="#6600cc">+</font><font color="#6600cc"> </font><font color="#6600cc">JRecord</font><font color="#6600cc"> </font><font color="#6600cc">Field</font><font color="#6600cc"> </font><font color="#6600cc">definition</font><font color="#6600cc">/</font><font color="#6600cc">Array</font><font color="#6600cc"> </font><font color="#6600cc">Details</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">33 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">34 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">pre</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">35 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc">So</font><font color="#6600cc"> </font><font color="#6600cc">that</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">36 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">37 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">JRecord</font><font color="#6600cc"> </font><font color="#6600cc">Schema</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">Cobol</font><font color="#6600cc"> </font><font color="#ff00cc">"</font><font color="#ff00cc">Item</font><font color="#ff00cc">"</font><font color="#6600cc"> </font><font color="#6600cc">tree</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">38 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">+</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">+</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">+</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">-</font><font color="#6600cc">+</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">39 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">schema</font><font color="#6600cc">.</font><font color="#6600cc">getRecord</font><font color="#6600cc">(</font><font color="#6600cc">index</font><font color="#6600cc">)</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">---</font><font color="#0000ff">></font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">recordItems</font><font color="#6600cc">.</font><font color="#6600cc">get</font><font color="#6600cc">(</font><font color="#6600cc">index</font><font color="#6600cc">)</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">40 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">pre</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">41 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*/</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">42 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> List<font color="#000000"><strong><</strong></font>? <font color="#009966"><strong>extends</strong></font> IItem<font color="#000000"><strong>></strong></font> recordItems;
<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>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">45 </font></span> <font color="#6600cc">/**</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">46 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#6600cc">Holds</font><font color="#6600cc"> </font><font color="#6600cc">the</font><font color="#6600cc"> </font><font color="#6600cc">Cobol</font><font color="#6600cc">-</font><font color="#6600cc">Item</font><font color="#6600cc">-</font><font color="#6600cc">Tree</font><font color="#6600cc"> </font><font color="#6600cc">complete</font><font color="#6600cc"> </font><font color="#6600cc">with</font><font color="#0000ff"><</font><font color="#0000ff">ul</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">47 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">li</font><font color="#0000ff">></font><font color="#6600cc">JRecord</font><font color="#6600cc"> </font><font color="#6600cc">Field</font><font color="#6600cc">/</font><font color="#6600cc">Array</font><font color="#6600cc"> </font><font color="#6600cc">definitions</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">48 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">li</font><font color="#0000ff">></font><font color="#6600cc">Cobol</font><font color="#6600cc"> </font><font color="#6600cc">copybook</font><font color="#6600cc"> </font><font color="#6600cc">details</font><font color="#6600cc"> </font><font color="#6600cc">like</font><font color="#6600cc"> </font><font color="#6600cc">picture</font><font color="#6600cc">,</font><font color="#6600cc"> </font><font color="#6600cc">usage</font><font color="#6600cc">,</font><font color="#6600cc"> </font><font color="#6600cc">occurs</font><font color="#6600cc"> </font><font color="#6600cc">position</font><font color="#6600cc"> </font><font color="#6600cc">length</font><font color="#6600cc"> </font><font color="#6600cc">etc</font><font color="#6600cc">.</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">49 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">li</font><font color="#0000ff">></font><font color="#6600cc">Array</font><font color="#6600cc"> </font><font color="#6600cc">Definition</font><font color="#6600cc"> </font><font color="#6600cc">details</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">50 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*</font><font color="#6600cc"> </font><font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">ul</font><font color="#0000ff">></font><font color="#6600cc"> </font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">51 </font></span><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*/</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">52 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> ICopybook cobolCopybook;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">53 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">54 </font></span> <font color="#6600cc">/**</font><font color="#6600cc"> </font><font color="#6600cc">IOBuilder</font><font color="#6600cc"> </font><font color="#6600cc">for</font><font color="#6600cc"> </font><font color="#6600cc">the</font><font color="#6600cc"> </font><font color="#6600cc">schema</font><font color="#6600cc"> </font><font color="#6600cc">*/</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">55 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> ISchemaIOBuilder ioBuilder;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">56 </font></span>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">57 </font></span> <font color="#6600cc">/**</font><font color="#6600cc"> </font><font color="#6600cc">Adhoc</font><font color="#6600cc"> </font><font color="#6600cc">Schema</font><font color="#6600cc"> </font><font color="#6600cc">(</font><font color="#6600cc">Cobol</font><font color="#6600cc"> </font><font color="#6600cc">Copybook</font><font color="#6600cc">)</font><font color="#6600cc"> </font><font color="#6600cc">information</font><font color="#6600cc"> </font><font color="#6600cc"> </font><font color="#6600cc">*/</font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">58 </font></span> <font color="#009966"><strong>public</strong></font> <font color="#009966"><strong>final</strong></font> ISchemaInformation copybookInformation;
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">59 </font></span>
</font></pre>
<P>
<P>This class is currently used in <font color="blue">Cobol2Xml</font> sub-project. It could be used for Cobol-Data ==> JSON conversion as well.
<P>
<P><B>Note: </B>Currently this class does not support the <B>Split on Redefines</B>
<P><B>Note: </B>The class <B>CobolSchemaReader</B> is "Extended" by <font color="blue">Cobol2Xml</font>
So if you want to see how <B>CobolSchemaDetails</B> can be used see the <font color="blue">Cobol2Xml</font>
sub project.
<P>
<HR><H2><A NAME="HDRCBL2CSV" HREF="#ToC_36" >Cobol2Csv & Csv2Cobol programs</A></H2>
<P>
<P>The <B>Cobol2Csv</B> and <B>Csv2Cobol</B> are now in a separate project - <a href="https://sourceforge.net/projects/coboltocsv">CobolToCsv</a>.
You can download the programs / documentation from <a href="https://sourceforge.net/projects/coboltocsv">CobolToCsv</a>.
<P>The <a href="http://record-editor.sourceforge.net" TARGET="_top">RecordEditor</a> can now generate Cobol2Csv bat/shell scripts, see <a href="http://coboltoxml.sourceforge.net/wCbl2X05.htm">RecordEditor - Generate CobolToXml</a>
<P>
<P>If you have <font color="blue"><b>simple COBOL files</b></font> (one record type and no duplicate field names),
you can use <B>Cobol2Csv</B> and <B>Csv2Cobol</B> programs. These programs
will convert a single record cobol file to / from a CSV file. If you pro
The big advantages are:
<UL COMPACT>
<LI>No programming is involved.
<LI>You keep your code base clear of <I>Cobol</I>, you just using existing Csv Skills / packages.
<LI>Can use other languages (other than java) or load into a DB.
</UL>
<P>