Reading COBOL datastructures from Java

后端 未结 8 915
情深已故
情深已故 2020-12-13 05:14

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 da

相关标签:
8条回答
  • 2020-12-13 05:34

    Microfocus provide a way of calling OO COBOL from Java.

    "You can write classes in OO COBOL which can be called from Java programs as though they were Java classes. You do this by providing a Java wrapper class, which provides a function for each method in the OO COBOL class. The Net Express Class and Method Wizards make this easy for you, by generating the Java code at the same time as the COBOL code."

    They also provide a tool called Enterprise Server which allows COBOL to interact with web services.

    If you have a COBOL program A, the tool allows you to expose A's interface section as a web service.

    Of course, because A now has a web service any other type of program (command line, Windows application, Java, ASP etc.) can now also call it and hence pass the COBOL data across to a Java program.

    0 讨论(0)
  • 2020-12-13 05:37

    Rational Application Developer can read COBOL source code and generate Java classes. The generated classes have methods for accessing the various part of the COBOL data structure. The class that is generated is compatible with the J2EE Connector Architecture. To create a class in your project, select File, New, Other then select the CICS/IMS Java Data Binding wizard under J2C. Click next. Choose COBOL to Java for mapping. Select your COBOL file. Select the structure you wish to generate a Java class for then click Finish and there you go. There are of course a number of options you can select along the way that I didn't mention. For more information search Help for J2C.

    0 讨论(0)
  • 2020-12-13 05:40

    Have a look at Javolution Struct.

    You can then use a macro to convert your COBOL datat into Struct.

    0 讨论(0)
  • 2020-12-13 05:43

    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 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

    Update Aug 2017

    The RecordEditor has a Generate option for generating Java / JRecord code from a COBOL Copybook. See RecordEditor Code Generation notes for details.

    Update Jan 2018

    There is some information on generating Java~JRecord code in this question / answer:

    How do you generate java~jrecord code for a Cobol copybook

    0 讨论(0)
  • 2020-12-13 05:49

    BEA used to have a product named JAM that was used to communicate with mainframe COBOL programs. It included a tool that would read copybooks and generate both corresponding Java POD classes and data conversion code.

    I don't know if this is still available, I lost track of it when I left BEA.

    0 讨论(0)
  • 2020-12-13 05:55

    Yes. I have done that before. I used an ODBC connection to COBOL files, and then with jdbc:odbc bridge, I used metadata information to generate classes, read data and port it all to Oracle.

    Here is a nice tutorial on how to access metada information with JDBC. Here is another one.

    Keep in mind that you don't need the JDBC:ODBC bridge approach. If you can get a native JDBC driver to connect to your Cobol DataSource, it will be better. In this regard, I also used an IBM native driver. Don't remember the name though. It was a long time ago.

    0 讨论(0)
提交回复
热议问题