Cannot find JRecord dependency for file conversion from Cobol

2k Views Asked by At

I have a piece of code which has JRecord related components and Maven cannot find the dependency for cb2xml, so all the code is red. I looked for info on the internet, but could not find much. So ICobolIOBuilder, JRecordInterface1 and everything related to JRecord cannot be found.

I will post my code, can anyone help me with the dependencies?

final ICobolIOBuilder ioBldr = JRecordInterface1.COBOL
        .newIOBuilder(copyBookFile)
        .setFont("cp273")
        .setDialect(ICopybookDialects.FMT_MAINFRAME);

final AbstractLineReader reader = ioBldr.newReader(dataFile);
AbstractLine l;

while ((l = reader.read()) != null) {

    System.out.println(">>>>>" + l.getFullLine());
    System.out.print("<<<<<");

    final FieldIterator iter = l.getFieldIterator(0);
    while (iter.hasNext()) {
        final AbstractFieldValue field = iter.next();
        System.out.print("|" + field.getFieldDetail().getName() + "=" + field.asString());
    }
    System.out.println("");

}

reader.close();

The dependencies related to Cobol I have are:

<dependency>
    <groupId>net.sf.cobol2j</groupId>
    <artifactId>cobol2j</artifactId>
    <version>1.5.4</version>
</dependency>

<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
</dependency>
2

There are 2 best solutions below

0
On

Please add following dependency in pom.xml file

     <dependency>
        <groupId>net.sf</groupId>
        <artifactId>jrecord</artifactId>
        <version>0.90.2</version>
    </dependency

Add repository:

    <repositories>
        <repository>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>central</id>
            <name>maven2</name>
            <url>https://repo.maven.apache.org/maven2</url>
        </repository>

        <repository>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>pentaho</id>
            <name>omni</name>
            <url>https://nexus.pentaho.org/content/groups/omni</url>
        </repository>
</repositories>

It will download all necessary files from Pentaho Now you can do maven update and maven clean install

2
On

You need to build cb2xml with maven first.

If you downloaded JRecord from Source Forge, The source for cb2xml should be in the Source\OtherSource\cb2xml_package directory.

Other options for Getting cb2xml source are