JRecord project provides code to:
- Read and write files of length based records (both fixed length records and Length field based records).
- Read and Write native cobol files.
Issues
- Code was written to support the RecordEditor not for reading Cobol Files.
- Data is returned as a String.
- Better Generic Cobol is needed
File Formats
- Length based files have 2 advantages over typical unix/windows text files:
- When reading, you do not need to check every byte in the file for a < CR >.
- Ideal for storing binary data - Saves the conversion cost (in 3rd generation languages like C and Cobol).
Formats Currently Supported
- Fixed Record Length (ie every record is the same fixed length.
- Mainframe VB (was also used on other computers as well).
- Mainframe VB Dump (sames as VB but also including the the Block Discriptor Word).
- Fujitsu Cobol VB format.
Examples
Reading a File
This example shows how a ByteReader is Read a Fujitsu-Cobol variable length file as a array of Bytes.
Note: Each line in these files consist of
4 byte Record descriptor (2 byte length in little endian binary format, 2 bytes check data).
Line Data
4 byte Record descriptor. Having the Record descriptor at the start and end of a record allows you to read forward and backwards in the file.
1: AbstractByteReader tReader = new FujitsuVbByteReader();
2: byte[] line;
3:
4: try {
5: tReader.open(fileName);
6:
7: while ((line = tReader.read()) != null) {
8: // TODO Do Something .....
9: }
10: } finally {
11: tReader.close();
12: }
Product's homepage
What's New in This Release: [ read full changelog ]
· This version fulfills a couple of user requests.
· There is an option for having column names in quotes for CSV files, and an enhanced copy utility.