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

Comp-3 function #12

Closed
mlbelobraydi opened this issue Sep 16, 2020 · 4 comments · Fixed by #20 or #21
Closed

Comp-3 function #12

mlbelobraydi opened this issue Sep 16, 2020 · 4 comments · Fixed by #20 or #21
Assignees

Comments

@mlbelobraydi
Copy link
Owner

Is your feature request related to a problem? Please describe.
The production data has several fields that are comp-3

Describe the solution you'd like
The positions in bytes are less than the ending number of digits. The pic_signed function does not account for this and an additional function needs to be created

Describe alternatives you've considered
Tried to find a way to modify pic_signed and it isn't possible and will require a new function for comp-3

Additional context
Information on Comp-3 can be found here
http://www.3480-3590-data-conversion.com/article-packed-fields.html

@mlbelobraydi
Copy link
Owner Author

Does this fix pic_V999

@mlbelobraydi
Copy link
Owner Author

mlbelobraydi commented Sep 16, 2020

Reviewing work completed by @skylerbast in Cobol_types Comp3 function, the pic_signed function should be able to handle this request. Unknown how it unpacks the fields to create the correct decimal places.

@skylerbast
Copy link
Contributor

skylerbast commented Sep 22, 2020

You are referring to the Gas or Oil Production ledgers such as the ones described here, right? Unfortunately the pic_signed function won't work, we'll have to add a new one to handle COMP-3. The function you referred to in my repo should work with minimal modification. I'll make a PR and add it shortly.

The reason the pic_signed function doesn't work is because the "signed" data items aren't compressed like the COMP-3 ones are; the signed numbers are stored as the EBCDIC representation of the numerals and the sign is overpunched (1,234 would be stored as 0xF1F2F3C4, and -1,234 would be stored as 0xF1F2F3C4 for example). Therefore, to hold an digit number, the signed field must be bytes in size. So there's a small bit of space saved by overpunching the sign, but nothing huge. By contrast, COMP-3 numbers store the digits as their decimal values (rather than the code representing the digit's numeral), and adds a nibble at the end to represent the sign (1,234 would be stored as 0x01234C and -1,234 would be stored as 0x01234D). To store an digit number, the COMP-3 format requires bytes.

@mlbelobraydi mlbelobraydi self-assigned this Sep 28, 2020
@mlbelobraydi
Copy link
Owner Author

Started new branch to try and solve the addition of comp3

@mlbelobraydi mlbelobraydi linked a pull request Sep 28, 2020 that will close this issue
@mlbelobraydi mlbelobraydi linked a pull request Oct 1, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants