0

I am new to COBOL Copybook/ XML mapping. So please forgive me for any silly question I ask here.

Basically I'm required to perform XML to COBOL Copybook and vice versa transformation in a Java Application. I know it can be done in WebShpere Transformation eXtender (WTX) but my requirement is to do it in Java application where WTX runtime will not be available (I guess).

Is there any jars available which I can use in Java to perform these requirements? Any help in this regard would be much appreciated!

Sunny
  • 99
  • 1
  • 2
  • 7
  • Please clarify what "XML to COBOL Copybook [...] transformation in a Java Application" means. Are you using JNI to execute COBOL code from Java? – cschneid Apr 28 '18 at 02:26
  • Basically what I meat is my application will receive xml request which I need to convert into EBCIDIC binary which is fed to backend MF system to process. I don't know whether there is any JNI available for use in Java. I also know that this can be done in WTX but I need to do it in my Java application. Hope this clarify your confusion. Please suggest. – Sunny Apr 28 '18 at 03:02
  • @Sunny Did any answer help? If not please comment on these and/or change your question to be more specific. – Simon Sobisch May 14 '18 at 14:45

2 Answers2

1

Have look at CobolToXml project. It can convert Xml to a Mainframe Binary File using a Cobol Copybook. The Xml tags must match the Cobol field names though.

See CobolToXml description wiki

To Convert Xml to a Cobol binary file in java:

JRecordConstantVars constants = Cobol2Xml.JR_CONSTANTS;

Cobol2Xml.newCobol2Xml("G:/Users/Bruce01/RecordEditor_HSQL/CopyBook/Cobol/DTAR020.cbl")

                                 // Cobol Options
                 .setFileOrganization(constants.IO_FIXED_LENGTH)
                 .setDialect(constants.FMT_MAINFRAME)               
                 .setSplitCopybook(constants.SPLIT_NONE)      
                 .setFont("cp037")

      .xml2Cobol("G:/Users/Bruce01/RecordEditor_HSQL/SampleFiles/DTAR020.bin.xml",
                 "G:/Users/Bruce01/RecordEditor_HSQL/SampleFiles/DTAR020byJava.bin");

Disclaimer I wrote CobolToXml

Bruce Martin
  • 10,358
  • 1
  • 27
  • 38
0

Check out the cb2xml project at https://sourceforge.net/projects/cb2xml/

  • Click Download, unzip the downloaded .zip file.
  • Navigate to the lib folder. You can add the cb2xml*.jar files to your project and use them in your Java development.
Jagrut Sharma
  • 4,574
  • 3
  • 14
  • 19