#10 cb2xml.properties

v1.0_(example)
open
Bruce Martin
4
2015-04-09
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
    2015-03-27

    jrecord doesnt supports comp-2 fields

     
  • Bruce Martin
    Bruce Martin
    2015-03-27

    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

    • Anonymous
      2015-03-30

      Hi Bruce, Is there any utility/api is avialbale to work with comp-2 fields that you are aware of? TIA

       
  • Bruce Martin
    Bruce Martin
    2015-03-31

    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.

     
  • Nick Briggs
    Nick Briggs
    2015-03-31

    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.

     

  • Anonymous
    2015-04-09

    will comp-2 be supported as a scientific notation.

     


Anonymous


Cancel   Add attachments