Menu

#13 org.xml.sax.SAXParseException; systemId: file:<file>; lineNumber: 1; columnNumber: 8; Content is not allowed in prolog.

v1.0_(example)
open
1
2018-09-05
2018-09-04
Anonymous
No

Hi, I am trying out jRecord the first time and I am having problems. I used the jRecordGen to generate a reader for a fixed_width mainframe COBOL (cp037) file. When I run the code, it throws this exception:
[Fatal Error] fcustdat_COBOL_copybook_proper.txt:1:8: Content is not allowed in prolog.
~~> 0 net.sf.JRecord.Common.RecordException: Content is not allowed in prolog.

It appears it does not like the COBOL copybook, eventhough I generated the java code with this copybook and it has created the schema properly. It seems to be failing at the start.

I am really looking forward to using jRecord as a viable solution to read mainframe files. I would be grateful if you can tell me what I am doing wrong.

Attaching the code, file, copybook and exceptions. I tried copybook with 01 level starting at position 1 as well as position 8.

Thanks for your kind help

Thanks

1 Attachments

Discussion

  • Bruce Martin

    Bruce Martin - 2018-09-05

    I think ** cb2xml.jar **is missing from your class path. This jar does the Cobol Conversion.
    I will change JRecord so that it gives better messages!!!


    Also you have a second problem with the data file. It looks some of the record have been truncated.
    What I think might of happened is you have a VB file onthe Mainframe and have dropped the RDW (record length) when transfering it to the PC.

    Options include:

    • Copy to a fixed length file on the mainframe (Sort can do this) then transfer the Fixed Length file.
    • Use the RDW option when transfering the file

    If using JRecord there are options for Generic Processing:

    • line.getFieldIterator(0) - iterate through the fields
    • getCobolItems from the RecordDetail class - gives a more Cobol like view
    • Using CodeGen to generate the Code - it is just Velocity skeltons
     
  • Anonymous

    Anonymous - 2018-09-05

    Thanks for the prompt response. At first I used the cb2xml jar from jRecord distro 0.9 R6 but I had generated the java code using the jRecord_CodeGen. It seems that the distros are different. I then used the jRecord.jar and cb2xml.jar from the code gen distro. It worked for Datar020!!!!

    I want to try one more fixed width file and then a complicated VB file.

    Thanks again.

     

Anonymous
Anonymous

Add attachments
Cancel