#10 cb2xml.properties

v1.0_(example)
open
Bruce Martin
4
2015-02-14
2014-03-31
Anonymous
No

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)

Discussion

  • Bruce Martin
    Bruce Martin
    2014-03-31

    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

    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)
    

    indicating the parse found something unexpected at the start of the Cobol Copybook.

     

  • Anonymous
    2015-01-04

    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)

     
  • Bruce Martin
    Bruce Martin
    2015-01-04

    The error line/column is in

        [1,12] expecting: '.'
    

    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
  • Nick Briggs
    Nick Briggs
    2015-02-05

    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...

     
  • Bruce Martin
    Bruce Martin
    2015-02-05

    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:

    • use cb2xml.properties
    • use columns 6-72
    • use columns 8-80
    • use columns 6 10,000

    etc.

    You will be able to

    • change the default by

      CommonBits.setDefaultCobolTextFormat(USE_STANDARD_COLUMNS); // use 6-72
    • Specify the columns in the call

      schema = conv.loadCopyBook(
      csvArgs.copybookName, CopybookLoader.SPLIT_NONE,
      0, csvArgs.inFont,
      Cb2xmlConstants.USE_STANDARD_COLUMNS,
      csvArgs.binFormat, 0, new TextLog());
     
  • Nick Briggs
    Nick Briggs
    2015-02-05

    Thanks so much. I'll be looking forward to the new release.

     
  • Bruce Martin
    Bruce Martin
    2015-02-14

    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


Anonymous


Cancel   Add attachments