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. I think of a library which is taking into account the copybooks and 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.
Are there any other techniques to cope with the problem of reading COBOL data?
You could look at JRecord or cb2java. Both allow you to access COBOL files, but neither will generate the full classes.
Update Jan 2011
Since the original answer:
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)The RecordEditor has a Generate option for generating Java / JRecord code from a COBOL Copybook. See RecordEditor Code Generation notes for details.
There is some information on generating Java~JRecord code in this question / answer: