<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to File Organisation</title><link>https://sourceforge.net/p/jrecord/wiki/File%2520Organisation/</link><description>Recent changes to File Organisation</description><atom:link href="https://sourceforge.net/p/jrecord/wiki/File%20Organisation/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 01 Aug 2016 03:40:20 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/jrecord/wiki/File%20Organisation/feed" rel="self" type="application/rss+xml"/><item><title>File Organisation modified by Bruce Martin</title><link>https://sourceforge.net/p/jrecord/wiki/File%2520Organisation/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -39,6 +39,12 @@
 * **Constants.IO_VB_DUMP** - Raw Block format of a Mainframe-VB file. You get this format if you specify RECFM=U when reading it on the mainframe. 
 * **Constants.IO_VB_GNU_COBOL** - GNU (open-Cobol) VB format.

+If you are confused which structure to use, the [Record Editor Generate](http://record-editor.sourceforge.net/RecordEditorGenerate.htm#HDRJRECGEN) will read your file and work out the **FileOrganisation** to use
+and generate Java~JRecord code for you.
+
+
+---
+
 Behind the scenes JRecord has an interface **IByteReader** which has a key method read which read a line (or record) from the input file as an array of bytes.

     :::java
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruce Martin</dc:creator><pubDate>Mon, 01 Aug 2016 03:40:20 -0000</pubDate><guid>https://sourceforge.net385aa81b39e5bac9e53be49cb210f066a487bb82</guid></item><item><title>File Organisation modified by Bruce Martin</title><link>https://sourceforge.net/p/jrecord/wiki/File%2520Organisation/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -1,4 +1,4 @@
-## JRecoid File Structures
+## JRecord File Structures / File Organisation
 Unlike on Linux / Windows most Text files are going to have **\n** or **\r\n** marking the End of Line.
 On The **mainframe** the situation is quite different; the 2 main ways for organising lines are

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruce Martin</dc:creator><pubDate>Mon, 01 Aug 2016 01:01:29 -0000</pubDate><guid>https://sourceforge.net077f0397d494f086a3e19b56ec880df98d9e83cc</guid></item><item><title>File Organisation modified by Bruce Martin</title><link>https://sourceforge.net/p/jrecord/wiki/File%2520Organisation/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -46,12 +46,12 @@

 This leads to a logical class structure of        

-                              + - Windows/Linux_Text_File_Reader Class    
-                              ! - FB-Reader                      Class                                   
-                              ! - Mainframe VB                   Class
+                + - Windows/Linux_Text_File_Reader Class    
+                ! - FB-Reader                      Class                                   
+                ! - Mainframe VB                   Class
     IByteReader + - Fujitsu Cobol VB               Class        
-                              ! - GNU_Cobol VB                   Class
-                              + - Various Other IO               Class
+                ! - GNU_Cobol VB                   Class
+                + - Various Other IO               Class

 ### Why does the Mainframe use FB / VB

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruce Martin</dc:creator><pubDate>Mon, 01 Aug 2016 01:00:40 -0000</pubDate><guid>https://sourceforge.neta0dcbdfe9cc0af4c113cd38318575575f3183c95</guid></item><item><title>File Organisation modified by Bruce Martin</title><link>https://sourceforge.net/p/jrecord/wiki/File%2520Organisation/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -46,12 +46,12 @@

 This leads to a logical class structure of        

-                             + - Windows/Linux_Text_File_Reader Class    
-                             ! - FB-Reader                      Class                                   
-                             ! - Mainframe VB                   Class
-   IByteReader + - Fujitsu Cobol VB               Class        
-                             ! - GNU_Cobol VB                   Class
-                             + - Various Other IO               Class
+                              + - Windows/Linux_Text_File_Reader Class    
+                              ! - FB-Reader                      Class                                   
+                              ! - Mainframe VB                   Class
+    IByteReader + - Fujitsu Cobol VB               Class        
+                              ! - GNU_Cobol VB                   Class
+                              + - Various Other IO               Class

 ### Why does the Mainframe use FB / VB

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruce Martin</dc:creator><pubDate>Mon, 01 Aug 2016 00:59:08 -0000</pubDate><guid>https://sourceforge.netefe991b64c3701f063d51fc29cf45366d4d88197</guid></item><item><title>File Organisation modified by Bruce Martin</title><link>https://sourceforge.net/p/jrecord/wiki/File%2520Organisation/</link><description>&lt;div class="markdown_content"&gt;&lt;h2 id="jrecoid-file-structures"&gt;JRecoid File Structures&lt;/h2&gt;
&lt;p&gt;Unlike on Linux / Windows most Text files are going to have &lt;strong&gt;\n&lt;/strong&gt; or &lt;strong&gt;\r\n&lt;/strong&gt; marking the End of Line.&lt;br/&gt;
On The &lt;strong&gt;mainframe&lt;/strong&gt; the situation is quite different; the 2 main ways for organising lines are&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;FB&lt;/strong&gt; - Fixed length records - every record is a constant fixed length; there are &lt;strong&gt;no&lt;/strong&gt; \n (or \r) line markers&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VB&lt;/strong&gt; - Variable Length record - each record starts with a &lt;em&gt;Record Length&lt;/em&gt; and is followed the lines text or data. Again there is &lt;strong&gt;no&lt;/strong&gt; \n (or \r) line markers&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;FB File (constant recordlength records, no eol marker):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt; (Record  1 --------------------)
 (Record  2 --------------------)
 (Record  3 --------------------)
 (Record  4 --------------------)
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;VB File (length at the start of the record):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt; (Record Length)(Record  1 ----------------------------)
 (Record Length)(Record  2 ----------)
 (Record Length)(Record  3 ----------------------)
 (Record Length)(Record  4 ---------------)
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;For Linux / Windows Cobols there normally three types&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;FB&lt;/strong&gt; - Exactly the same as the Mainframe&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VB&lt;/strong&gt; - Similar to the mainframe, each Cobol does it differently though&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line-Sequential&lt;/strong&gt; - Standard Linux / Windows Text file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In JRecord, I try to handle all these different file Types. The &lt;strong&gt;setFileOrganisation&lt;/strong&gt; controls which IO routine is used.&lt;br/&gt;
JRecord includes the following options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Constants.IO_DEFAULT&lt;/strong&gt; - JRecord will decide the actual method based on other values (The Default Value). It is generally better to explicitly set the File-Organisation (or file-Structure). &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Constants.IO_STANDARD_TEXT_FILE&lt;/strong&gt; - Standard Windows/*nix/Mac text file using \n, \n\r etc as a record (or line) delimiter. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Constants.IO_UNICODE_TEXT&lt;/strong&gt; - Standard Windows/*nix/Mac Unicode / double byte text file using \n, \n\r etc as a record (or line) delimiter. It ensures record are stored in character format (instead of bytes). &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Constants.IO_FIXED_LENGTH&lt;/strong&gt; - Every Record (or line) is a standard Fixed length based on the Maximum schema length. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Constants.IO_FIXED_LENGTH_CHAR&lt;/strong&gt; - Fixed length character file (typically used for Fixed-Length unicode files). &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Constants.IO_VB&lt;/strong&gt; - Mainframe VB (Variable Record length file). Records consist of a Record-Length followed by the Record-Data. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Constants.IO_VB_DUMP&lt;/strong&gt; - Raw Block format of a Mainframe-VB file. You get this format if you specify RECFM=U when reading it on the mainframe. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Constants.IO_VB_GNU_COBOL&lt;/strong&gt; - GNU (open-Cobol) VB format. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Behind the scenes JRecord has an interface &lt;strong&gt;IByteReader&lt;/strong&gt; which has a key method read which read a line (or record) from the input file as an array of bytes.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="n"&gt;IOException&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This leads to a logical class structure of      &lt;br/&gt;
&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;                         + - Windows/Linux_Text_File_Reader Class    
                         ! - FB-Reader                      Class                                   
                         ! - Mainframe VB                   Class
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;IByteReader + - Fujitsu Cobol VB               Class      &lt;br/&gt;
                             ! - GNU_Cobol VB                   Class&lt;br/&gt;
                             + - Various Other IO               Class&lt;/p&gt;
&lt;h3 id="why-does-the-mainframe-use-fb-vb"&gt;Why does the Mainframe use FB / VB&lt;/h3&gt;
&lt;p&gt;The mainframe (and Cobol) use FB / VB for 2 reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt; - a lot of processing is used in checking if each character is a \n&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Support For Binary Data&lt;/strong&gt; - The FB/VB allow you to read/write binary data directly to the file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You will find the new binary protocols like &lt;a class="" href="https://developers.google.com/protocol-buffers/" rel="nofollow"&gt;Protocol Buffers&lt;/a&gt;&lt;br/&gt;
and &lt;a class="" href="https://avro.apache.org/" rel="nofollow"&gt;Avro&lt;/a&gt; have there own &lt;strong&gt;VB like&lt;/strong&gt; format for exactly the same reason as on the Mainframe.&lt;br/&gt;
&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruce Martin</dc:creator><pubDate>Mon, 01 Aug 2016 00:58:05 -0000</pubDate><guid>https://sourceforge.netc10ee2233beca7808de10381f1ca0b0064c67184</guid></item></channel></rss>