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

Support for decimal scaling PV #669

Closed
rjethure opened this issue Apr 15, 2024 · 6 comments
Closed

Support for decimal scaling PV #669

rjethure opened this issue Apr 15, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@rjethure
Copy link

Describe the bug

Cobrix should support the decimal scaling of character PV in copybook, getting error for S9(7)PPPV.
For usage click here

Expected behavior

It should parse the copybook file. Without below error:

ERROR ANTLRParser: Syntax error in the copybook: Line  no viable alternative at input XXXX:XX 'S9(7)PPPV'
Caused by: za.co.absa.cobrix.cobol.parser.exceptions.SyntaxErrorException: Syntax error in the copybook at line XXXX: Invalid input 'V' at position XXXX:XX

Copybook (if possible)

 05  Parent-Column                  COMP-3.              
     07  Child-1   PIC S9V99.                           
     07  Child-2   PIC S9(7)PPPV.                       
     07  Child-3   PIC S9V99.                           
     07  Child-4   PIC S9(7)PPPV.                       
     07  Child-5   PIC S9(7)PPPV.                       
     07  Child-6   PIC S9(7)PPPV.                       
     07  Child-7   PIC S9(7)PPPV.                       
     07  Child-8   PIC S999.                            
     07  Child-9   PIC S9(11).                          
@rjethure rjethure added the bug Something isn't working label Apr 15, 2024
@yruslan
Copy link
Collaborator

yruslan commented Apr 15, 2024

Hi @rjethure ,

Cobrix already supports integer and decimal scaling. It just does not support implicit comma 'V' at the and of the PIC. Please, try removing 'V' and let know if the behavior is as expected.

@rjethure
Copy link
Author

Hi @yruslan,

Thank you for quick response.
I tried by removing 'V' from copybook. After removing 'V' copybook is getting parsed without error.

But input data file's column are not getting correctly parsed. I am suspecting it is messing with START and END indices of the columns.

@yruslan
Copy link
Collaborator

yruslan commented Apr 15, 2024

How exactly data is not correctly parsed? What is the expected and actual output?
You can use layout positions output from logs to determine if start and end offsets as as expected. Also you can use .option("debug", "true") to see raw values being decoded to spot mismatches.

@yruslan
Copy link
Collaborator

yruslan commented Apr 17, 2024

Is it sorted?

yruslan added a commit that referenced this issue Apr 17, 2024
For example, '9(7)PPPV' is the same as '9(7)PPP'.
yruslan added a commit that referenced this issue Apr 18, 2024
For example, '9(7)PPPV' is the same as '9(7)PPP'.
@yruslan
Copy link
Collaborator

yruslan commented Apr 18, 2024

The support for PIC S9(7)PPPV is implemented and now is in the master branch. The logic is the same as for PIC S9(7)PPP, according to this:
https://knowledge.informatica.com/s/article/109965?language=en_US

@yruslan
Copy link
Collaborator

yruslan commented Apr 23, 2024

The feature is available in spark-cobol:2.7.0

@yruslan yruslan closed this as completed Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants