There is no JSON Schema --> Cobol Copybook The latest version should do JSON_Data --> Cobol_Data (with a lot of limitations) e.g. Cobol2JsonSchema.newCobol2Json(Cbl2JsonCode.getFullName("cobol/amsPoDownload.cbl")) .setFileOrganization(IFileStructureConstants.IO_BIN_TEXT) .setSplitCopybook(CopybookLoader.SPLIT_01_LEVEL) .setTagFormat(IReformatFieldNames.RO_UNDERSCORE) .setRecordSelection("PO-Record", Cobol2Json.newFieldSelection("Record-Type","H1")) .setRecordSelection("Product-Record", Cobol2Json.newFieldSelection("Record-Type","D1"))...
Hi Bruce, any updates on the JSON schema --> cobol ?. Thank you
I will be releasing a new CobolToJson using the latest JRecord. I am currently updating cb2xml, CobolToCsv and will release them together. I will have a look at JSon --> Cobol but it is not a high priority
Thanks for maintaining this project. It would be great if we can make CobolToJson two-way.
Do you mean you'd make CobolToJson work with the latest JRecord? That would be great!
The versions in Git-Hub should be fairly recent, I will yty to update them shortly https://github.com/bmTas/cb2xml https://github.com/bmTas/JRecord
Hi Bruce, Thanks you for maintaining this project. I'm trying to write code that converts a copybook to a sample JSON based on your code (speciifcally, Cobol2JsonImpl.java). I managed to do it but I got NullPointerException from cb2xml, couldn't debug since I didn't find sources for the libs you used. Thereore I use newer versions (cb2xml-1.01.1 and JRecord-0.90.2) However, these new versions are significantly different, so I had to change your code. I changed List<? extends IItem> items = cobolSchemaDetails.cobolCopybook.getCobolItems();...
Okay, I will try to use the cbl2xml by converting the json to xml and then to cbl. I have 0.90.2 (Cb2Xml and Jrecord)jar and I don't see the class Cobol2Xml, is there anything I missed? I want to use use the Cobol2Xml.newCobol2Xml ("sample.cbl") . . . .etc .xml2Cobol("sample.xml", "sample.txt");
Yes Cbl2Json is one way converter (The others are 2 ways). I will have a look at what is involved in doing 2 wayin the next couple of days/ (from memory it was going to be harder than Xml). Not a lot of people use the Convert though.
From the Screenshot you shared on wiki, it looks like the Cbl2Json converter is only one way? I see the Cbl2Xml and Cbl2Csv are two ways. Is that the case that I can't change Json back to Cobol with the new Cbl2Json Library? So what is better solution?
Thanks Bruce, I was to mean to put the data file and the schema and convert to json. Now I want to do exactly the reverse, change the JSON to Cobol format. I don't see any method in the Cobol2Json class. Does it do that? If so sample code that can convert Json back to Cobol?
I have created a Wiki on the RecordEditor/ReCsvEditor generate option https://sourceforge.net/p/coboltojson/wiki/CodeGeneration/
CodeGeneration
CodeGeneration
CodeGeneration
CodeGeneration
I need the full stack trace but obvious errors are You have use the same file for both the cobol copybook and the data file. I would expect Cobol2Json.newCobol2Json("sample.cbl") .setFont("cp037") .setFileOrganztion("Constants.IO_FIXED_LENGTH") .setSplitcopybook(CopybookLoader.SPLIT_NONE) .setTagFormat(IReformatFieldName.RO_UNDERSCORE) .cobol2json (new FileInputStream("sample_data_file.txt"), new FileOutputStream("sample.json")) the Cobol Copybook (sample.cbl) describes the file and will look like:...
Hi Bruce, Glad you come up with Cobol2Json Converter. It is going to be very helpful. I am trying to see the examples on github and also tried to change Cobol to Json. But there was no luck. Most of the examples uses "dot bin " files and I don't know what is the use of that file. Is there a simple example that takes "dot cbl" file and change it to "dot json" file? I really appreciate that. Here is my sample code. try{ Cobol2Json.newCobol2Json("sample.cbl") .setFont("cp037") .setFileOrganztion("Constants.IO_FIXED_LENGTH")...
Hi Bruce, Glad you come up with Cobol2Json Converter. It is going to be very helpful. I am trying to see the examples on github and also tried to change Cobol to Json. But there was no luck. Most of the examples uses "dot bin " files and I don't know what is the use of that file. Is there a simple example that takes "dot cbl" file and change it to "dot json" file? I really appreciate that. Here is my sample code. try{ Cobol2Json.newCobol2Json("sample.cbl") .setFont("cp037") .setFileOrganztion("Constants.IO_FIXED_LENGTH")...