AbsaOSS / cobrix

A COBOL parser and Mainframe/EBCDIC data source for Apache Spark

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DataType SVP9(15) is converting the value to Decimal(16,0) instead of Decimal(16,16)

rohitavantsa opened this issue · comments

Hi @yruslan

We have a copybook with a field having datatype SVP9(15). When reading the file with cobrix we are expecting the value to be a decimal value with Decimal(16,16) but instead we are seeing Decimal(16,0) and also we are not seeing any decimal fields while checking the data. But our onprem is processing it as decimal fields .

expected Value : 0.123456789131230
but actual value in cobrix output is getting a INT.

Copybook:
01 TABLE_NAME.
10 random_field1 PIC X(05)
10 random_field2 PIC SVP9(15) COMP-3.

Hi @yruslan Can you help us understand this.

This is probably a parser issue will take a look.

I have a question regarding scaling though. Shouldn't 'SVP9(15)' produce values like '0.012345' since 'P' indicates scaling. I'd expect:
PIC SV9(16) to read files like 0.1234567890123456 (maybe try using this PIC if if works for your use case)
PIC SVP9(15) to read as 0.0123456789012345 (since P goes after the decimal point

(see the spec) at word "his scales the value DOWN"

Hi @yruslan ,
yeah we expect to read as 0.0123456789012345 from SVP9(15) .

We will take a look, so far looks like a bug.

Hi, we are in the progress of fixing the bug. However, I've found a quick workaround.
You can use PIC SP9(15) (instead of SVP9(15)) to make precision and scale decode as you expect until the bug is fixed.

Hi @yruslan ,

Thanks for the update.
We found we have another field having SVP9 (15) comp-3 . We will try to implement PIC SP9(15) this datatype and test our file.