We are creating a XML feed using a copybook that has redefines. This process is working fine, but further down-stream we are hitting XML parsing problems. This is because the record in question contains packed decimal values, and these come out in the base record as well as the redefined record. Simple example
As you can see here, the XML "Base-Data" content has control characters, which cause our down-stream parsing to fail.
Since we already have the correctly interpreted values displayed in the "Data" structure, is there any way to tell JRecord (at the Cobol2Xml level I guess) to not display "base data" if it's already been redefined?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. I notice Cobol2GroupXml.cobol2xml is using the stock javax.xml.stream.XMLOutputFactory. If you extend the Cobol2Xml interface to set an XMLOutputFactory, you can then use something like the woodstox XMLOutputFactory - this allows an "InvalidCharHandler" to be defined, so it pushes the onus back on the caller to decide what to do when a NULL or something dodgy is encountered.
Trailing Low-Values (Hex-Zeros) are dropped from all fields
Redefined-Fields are now validated (When there is a redefined Comp*)
The changes where applied to my "Updated-JRecord" which is very close another release
So I suggest doing some Regression Tests. From a user perspective there should be few visible
changes but there have been substantial internal changes:
IOBuilder / Cobol2Xml Interface Hierarchy has been changed. Also implementing classes
have undergone substantial changes.
Csv-IOBuilders and Fixed-Width-IOBuilders have been fixed and Test cases written
Cobol2Csv classes have been rewritten with Csv-IOBulder and Cobol-IOBuilders.
Fixes for Occurs-Depending have been made.
For Cobol2Csv there are now tests for partially filled arrays; These tests are used
in both Cobol ==> Xml and Xml ==> Cobol. Basically you can:
Check a whole array element for spaces / low-values / high-values before creating the Xml.
Set a array-size field
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Bruce,
We are creating a XML feed using a copybook that has redefines. This process is working fine, but further down-stream we are hitting XML parsing problems. This is because the record in question contains packed decimal values, and these come out in the base record as well as the redefined record. Simple example
Data:
Copybook:
XML:
As you can see here, the XML "Base-Data" content has control characters, which cause our down-stream parsing to fail.
Since we already have the correctly interpreted values displayed in the "Data" structure, is there any way to tell JRecord (at the Cobol2Xml level I guess) to not display "base data" if it's already been redefined?
Thanks.
I probably advised against using the cobol-to-xml when there is a redefines for this very reason
(If I did not, I meant to).
That said, I should be able to Test redefined fields if they are valid. The one issue is the processing cost.
I will do some testing and get back to you.
Thanks. I notice Cobol2GroupXml.cobol2xml is using the stock javax.xml.stream.XMLOutputFactory. If you extend the Cobol2Xml interface to set an XMLOutputFactory, you can then use something like the woodstox XMLOutputFactory - this allows an "InvalidCharHandler" to be defined, so it pushes the onus back on the caller to decide what to do when a NULL or something dodgy is encountered.
E.g. code snippets:
Cobol2GroupXml
I think it's quite an elegant solution,.
Last edit: Brian Reynolds 2016-03-17
I will
There is a new Download: https://sourceforge.net/projects/jrecord/files/jrecord/Version_0.80.8i/JRecord_Upgrade_20_Mar_2016.7z/download
that holds these Changes
The changes where applied to my "Updated-JRecord" which is very close another release
So I suggest doing some Regression Tests. From a user perspective there should be few visible
changes but there have been substantial internal changes:
have undergone substantial changes.
Fixes for Occurs-Depending have been made.
For Cobol2Csv there are now tests for partially filled arrays; These tests are used
in both Cobol ==> Xml and Xml ==> Cobol. Basically you can: