Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Error While converting Mainframes EBCDIC file to ASCII - Exception in thread "main" java.lang.AssertionError: assertion failed #387

Closed
BalanarayanaG opened this issue May 3, 2021 · 2 comments
Labels
accepted Accepted for implementation bug Something isn't working

Comments

@BalanarayanaG
Copy link

Describe the bug

We are able to convert the normal ebcdic files to ascii using cobrix. But when we tried to convert packed values (Ex: PIC S9(18)V USAGE COMP-3.) to ascii it is giving an error. Please help me with this

Schema file:
******************************************************************
* COBOL DECLARATION FOR TABLE XXXYY00 *
******************************************************************
01 XXXYY00.
10 FIELD-ID1 PIC S9(4) USAGE COMP.
10 FIELD-ID2 PIC S9(9) USAGE COMP.
10 FIELD-ID3 PIC S9(18) USAGE COMP.
10 FIELD-ID4 PIC S9(9) USAGE COMP.
10 FIELD-ID5 PIC S9(18)V USAGE COMP-3.
10 FIELD-ID6 USAGE COMP-2.
******************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 6 *
******************************************************************
ERROR LOG:

Exception in thread "main" java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:156)
at za.co.absa.cobrix.cobol.parser.antlr.ParserVisitor.visitPrimitive(ParserVisitor.scala:769)
at za.co.absa.cobrix.cobol.parser.antlr.ParserVisitor.visitPrimitive(ParserVisitor.scala:43)
at za.co.absa.cobrix.cobol.parser.antlr.copybookParser$PrimitiveContext.accept(copybookParser.java:2902)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
at za.co.absa.cobrix.cobol.parser.antlr.copybookParserBaseVisitor.visitItem(copybookParserBaseVisitor.java:408)
at za.co.absa.cobrix.cobol.parser.antlr.copybookParser$ItemContext.accept(copybookParser.java:3135)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
at za.co.absa.cobrix.cobol.parser.antlr.ParserVisitor.visitMain(ParserVisitor.scala:446)
at za.co.absa.cobrix.cobol.parser.antlr.ANTLRParser$.parse(ANTLRParser.scala:81)
at za.co.absa.cobrix.cobol.parser.CopybookParser$.parseTree(CopybookParser.scala:216)
at za.co.absa.cobrix.cobol.reader.FixedLenNestedReader.loadCopyBook(FixedLenNestedReader.scala:107)
at za.co.absa.cobrix.cobol.reader.FixedLenNestedReader.(FixedLenNestedReader.scala:58)
at za.co.absa.cobrix.spark.cobol.reader.FixedLenTextReader.(FixedLenTextReader.scala:53)
at za.co.absa.cobrix.spark.cobol.source.DefaultSource.createTextReader(DefaultSource.scala:88)
at za.co.absa.cobrix.spark.cobol.source.DefaultSource.buildEitherReader(DefaultSource.scala:74)
at za.co.absa.cobrix.spark.cobol.source.DefaultSource.createRelation(DefaultSource.scala:59)
at za.co.absa.cobrix.spark.cobol.source.DefaultSource.createRelation(DefaultSource.scala:47)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:318)
at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:178)

To Reproduce

Steps to reproduce the behaviour OR commands run:

  1. Go to '...'
  2. Click on '....'
  3. Enter value '...'
  4. See error

Expected behaviour

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

@BalanarayanaG BalanarayanaG added the bug Something isn't working label May 3, 2021
@yruslan
Copy link
Collaborator

yruslan commented May 11, 2021

Sorry for the delay. Will take a look

@yruslan
Copy link
Collaborator

yruslan commented May 13, 2021

This looks like a parser issue. We will fix it in the future, but for now just remove the USAGE token from FIELD-ID6 (which uses COMP-2)

@yruslan yruslan added the accepted Accepted for implementation label May 13, 2021
yruslan added a commit that referenced this issue May 14, 2021
* COMP-1 and COMP-2 failed parsing if 'USAGE' or 'USAGE IS' keywords are used.
yruslan added a commit that referenced this issue May 18, 2021
* COMP-1 and COMP-2 failed parsing if 'USAGE' or 'USAGE IS' keywords are used.
yruslan added a commit that referenced this issue May 21, 2021
* COMP-1 and COMP-2 failed parsing if 'USAGE' or 'USAGE IS' keywords are used.
@yruslan yruslan closed this as completed Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Accepted for implementation bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants