Hi Bruce, I installed JRecord and try to compile the example given for read a Cobol file, but it appears to have some problem finding the cb2xml.properties file. Here's the Exception log:
Properties File: /C:/Program%20Files/JRecord/jars/JRecord.properties false
java.io.FileNotFoundException: cb2xml.properties (El sistema no puede encontrar el archivo especificado)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at net.sf.cb2xml.CobolPreprocessor.preProcess(Unknown Source)
at net.sf.cb2xml.CobolPreprocessor.preProcess(Unknown Source)
at net.sf.JRecord.External.Def.Cb2Xml.convert(Cb2Xml.java:102)
at net.sf.JRecord.External.Def.Cb2Xml.convertToXMLDOM(Cb2Xml.java:72)
at net.sf.JRecord.External.CobolCopybookLoader.loadCopyBook(CobolCopybookLoader.java:81)
at net.sf.JRecord.IO.CobolIoProvider.getLineReader(CobolIoProvider.java:94)
at net.sf.JRecord.IO.CobolIoProvider.getLineReader(CobolIoProvider.java:62)
at Main.main(Main.java:26)
*** using start column = 6, end column = 72
net.sf.cb2xml.sablecc.parser.ParserException: [1,1] expecting: number88, number not88
at net.sf.cb2xml.sablecc.parser.Parser.parse(Unknown Source)
at net.sf.JRecord.External.Def.Cb2Xml.convert(Cb2Xml.java:112)
at net.sf.JRecord.External.Def.Cb2Xml.convertToXMLDOM(Cb2Xml.java:72)
at net.sf.JRecord.External.CobolCopybookLoader.loadCopyBook(CobolCopybookLoader.java:81)
at net.sf.JRecord.IO.CobolIoProvider.getLineReader(CobolIoProvider.java:94)
at net.sf.JRecord.IO.CobolIoProvider.getLineReader(CobolIoProvider.java:62)
at Main.main(Main.java:26)
java.lang.NullPointerException
at net.sf.JRecord.External.CobolCopybookLoader.loadCopyBook(CobolCopybookLoader.java:92)
at net.sf.JRecord.IO.CobolIoProvider.getLineReader(CobolIoProvider.java:94)
at net.sf.JRecord.IO.CobolIoProvider.getLineReader(CobolIoProvider.java:62)
at Main.main(Main.java:26)
Anonymous
The cb2xml.properties message is a warning rather than error, cb2xml will default to use columns 6 to 72 indicated by:
*** using start column = 6, end column = 72
You could create an empty cb2xml.properties file if you want
The critical error is in
indicating the parse found something unexpected at the start of the Cobol Copybook.
I am getting the same (or a similar) error. Is there a way to tell from the .ParserException line where the error in the copybook is?
Here is my Error:
*** using start column = 6, end column = 72
*** fatal parse error ***
[1,12] expecting: '.'
Exception in thread "main" java.lang.NullPointerException
at net.sf.JRecord.External.CobolCopybookLoader.loadCopyBook(CobolCopybookLoader.java:146)
at tsys.terms.main(terms.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
The error line/column is in
The error is in (or before) line 1 column 12
Also make sure there are no tabs in the copybook (first 7 chars of the line). Some editors stick them in, They cause unexpected errors in cb2xml.
Last edit: Bruce Martin 2015-01-04
Regarding the original question -- about cb2xml.properties -- I guess it's a cb2xml issue, really, but it would be great if it DIDN'T just try to open the file with
propsStream = new FileInputStream("cb2xml.properties");and spew the stack trace if it fails. That's going to attempt to open the file in whatever the current working directory is, which makes it hard for someone attempting to package a utility...
I have already made these changes and will be putting out a new version next week where you do not need the cb2xml.properties file.
JRecord will still use cb2xml.properties by default (for backward compatibility) but
you will be able. You will have the options will be:
etc.
You will be able to
Thanks so much. I'll be looking forward to the new release.
In Version 0.80.8, I have JRecord so that
Using columns of 6-71 is the default (with out referencing cb2xml.properties) when using the new IOBuilder classes.
Loading columns from cb2xml.properties is still the default for existing methods; but you can change the default with:
CommonBits.setDefaultCobolTextFormat(Cb2xmlConstants.USE_STANDARD_COLUMNS);
There is a new parameter when reading a CobolCopybook where you can specify the columns (6-71; 6-80, 6->....).
Last edit: Bruce Martin 2015-02-14
jrecord doesnt supports comp-2 fields
Anonymous, That is correct. comp-1, comp-2 are rarely used in cobol so this would be of limited interest to most people.
I am on holidays now so can not look at it at the moment and given it is rarely used in copybooks, i will not be doing anythin soon. i may look at it someday.
Last edit: Bruce Martin 2015-03-28
Hi Bruce, Is there any utility/api is avialbale to work with comp-2 fields that you are aware of? TIA
not that I am aware of, you could check legstar; not sure if they do but probably not. I have seen the format explained recently; I will look for this explanation again.
basically for floats, the mainframe has 1 more detail bit (and one less mantisaa) than the standard Float. Double (float 2) probably has 2 extra bits in the detail.
I would get the floats translated to something else if you can.
http://www-01.ibm.com/support/knowledgecenter/#!/SS6SG3_3.4.0/com.ibm.entcobol.doc_3.4/cpari09.htm
Internal floating-point (COMP-1 and COMP-2) items
COMP-1 refers to short floating-point format and COMP-2 refers to long floating-point format, which occupy 4 and 8 bytes of storage, respectively. The leftmost bit contains the sign and the next 7 bits contain the exponent; the remaining 3 or 7 bytes contain the mantissa.
Since they're internal format it depends on exactly what hardware you're coming from. On some IBM systems COMP-1 and COMP-2 are in IEEE floating point format.
Wikipedia has a description of the float 1 / 2 formats
the following also has details on conversion
Last edit: Bruce Martin 2015-04-04
will comp-2 be supported as a scientific notation.
Tried to Display a supplied Copybook and received the following error:
[line=1, colum=11] expecting: number88, number not88
Not sure what to do.
The Messagesmeans a Cobol Level number was expected but not found on line 1, colun 11.
which copybook; what Java code did you use ???
It would be better if you:
Last edit: Bruce Martin 2019-03-08