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
FB File (constant recordlength records, no eol marker):
(Record 1 --------------------)
(Record 2 --------------------)
(Record 3 --------------------)
(Record 4 --------------------)
VB File (length at the start of the record):
(Record Length)(Record 1 ----------------------------)
(Record Length)(Record 2 ----------)
(Record Length)(Record 3 ----------------------)
(Record Length)(Record 4 ---------------)
For Linux / Windows Cobols there normally three types
In JRecord, I try to handle all these different file Types. The setFileOrganisation controls which IO routine is used.
JRecord includes the following options:
If you are confused which structure to use, the Record Editor Generate 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.
public abstract byte[] read() throws IOException;
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
The mainframe (and Cobol) use FB / VB for 2 reasons:
You will find the new binary protocols like Protocol Buffers
and Avro have there own VB like format for exactly the same reason as on the Mainframe.