Is there a way to read cobol data in a Java program? More concretely I'm confronted with the following case:
I have a file with fixed length records of data. The data definition is done as Cobol copybooks. What I think of is a library which taking into account the copybooks would be able to read those records.
Ideally it should be possible to generate basic java classes and structures based on the copybook information. In a later step the datarecords would be parsed and the data filled into objects of those generated classes.
Do you know a library providing this kind of functionality? Or any other techniques to cope with the problem of reading cobol data?
There are some commercial tools which provide this functionality. They are, however, very expensive. Do you know any open-source alternative or a combination of different tools to provide the entire functionality? For example the cb2xml reads copybook structures and transforms them into xml. A later step would be to generate a record reader based on the cb2xml xml information. Or to use a record reader which is configurable. Do you know a cobol record reader (decoder)?
解决方案
You could look at JRecord - http://sourceforge.net/projects/jrecord/
or cb2java http://sourceforge.net/projects/cb2java/ both allow you to access cobol files
but neither will generate the full classes.
Since the original Answer:
JRecord continues be developed. There is now a JRecord Code generator available as
either a standalone program or in the Recordeditor.
This Code Generator will build JRecord JRecord code from a Cobol Copybook.
See RecordEditor Jrecord CodeGen
Development on cb2java has stopped
cobol2j has been written. There have been no updates
for a year.
There is also Legstar again nothing published for a few years