Decimal to COMP3
Moderators: chulett, rschirm, roy
COMP-3
I have to admit that I have not had much success with reversing this code. The original code hardly makes sense.
I am now using iconv with an MP coversion code to pack a number. I ftp the file to the mainframe as binary with no conversion to ebcdic.
Negative whole numbers are sucessful, but I can't pack positive numbers or decimals. Positive numbers do not include the sign bit.
Does any have any thoughts on this one??
I am now using iconv with an MP coversion code to pack a number. I ftp the file to the mainframe as binary with no conversion to ebcdic.
Negative whole numbers are sucessful, but I can't pack positive numbers or decimals. Positive numbers do not include the sign bit.
Does any have any thoughts on this one??
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: COMP-3
Is that because of your unfamiliarity with the language, or do you really have a problem with the logic?pnetti wrote:The original code hardly makes sense.
The Iconv() and Oconv() functions are perilous ground for newbies, particularly the ones that handle binary data.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
COMP 3
I am not that familiar with the language.
When I review the code of the existing routines, it doesnt seem like I can just reverse the logic.
For example, the current routines do not handle the implied decimal. The packed number is converted as a whole number then divided by a number to move the decimal point.
I dont think this approach will work in the reverse order. But as I said, I am not really that strong with the basic language.
(Not only do I need to convert to comp-3, I have to convert to signed comp fields.)
When I review the code of the existing routines, it doesnt seem like I can just reverse the logic.
For example, the current routines do not handle the implied decimal. The packed number is converted as a whole number then divided by a number to move the decimal point.
I dont think this approach will work in the reverse order. But as I said, I am not really that strong with the basic language.
(Not only do I need to convert to comp-3, I have to convert to signed comp fields.)