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

How do you use the RecordEditor to Generate Java~JRecord code from a Cobol Copybook to read/write a Binary EBCDIC Mainframe File.

This a Question and answer to try an prevent some poor/misleading questions being asked or the answer can be pointed to.


  • File Transfer

    To transfer a Binary file from the Mainframe to Windows / *nix box you must do a Binary Transfer for a very simple reason: the Ebcdic --> Ascii program can not distinguish between binary fields and Text fields.

    Comp-3 value   hex     hex after Ascii conversion
     400          x'400c'       x'200c'       x'40' is the ebcdic space character
                                              it gets converted to the ascii
                                              space character x'20'

    You need to do a Binary transfer from the Mainframe. This will keep the file as EBCDIC and any binary fields will be untouched. You then read the file using Ebcdic.

    You will need to check the RECFM on the Mainframe. If the RECFM is

    RecordEditor CodeGen

    The RecordEditor will use details from a Cobol Copybook and a Sample file to generate Java~JRecord Code.

    Installing the Recordeditor

    Install version 0.98.4 or later. Consider the USB version, you just unzip to a normal directory and run from there. No install is needed

    If you install either HSQL version, restart the computer before use

    Starting the Code Generator

    To start the Code-Generator, select Generate >>> Java~JRecord code for Cobol

    enter image description here

    First Generate Screen

    On this screen enter the Cobol Copybook and Sample file (if you have one). The RecordEditor will try and fill in the fields for you.

    enter image description here

    You may need to fix up the control fields though. When everything is correct

    enter image description here

    When everything is correct press the Generate Java~JRecord button

    Second Generate Screen

    On this screen you can

    enter image description here

    Generated code

    There are several Templates or Models that can be used, including

    press the Generate Code button to generate java code.


    enter image description here

    Pojo: enter image description here