2

I'm starting a new adventure to convert COBOL program to a Ruby program, I have to convert a a comp-3/packed decimal format to number.

From another previous post, there is code that would convert from a number to comp-3, but not the inverse.

Community
  • 1
  • 1
RedNax
  • 1,507
  • 1
  • 10
  • 20
  • All you need is the inverse of that previous answer. Why is that hard? – Ira Baxter Apr 07 '11 at 08:49
  • 2
    Did inverse it, however, it came up with some funny characters. Have since resolved it by having the client "DISPLAY" the data without it all packed. Thanks for looking at this. – RedNax Apr 14 '11 at 09:30
  • @RedNax, you can post your solution as an answer and accept it ;) then people can vote it up if it helps them... you might also include a sample of how to convert a comp-3 into a displayable format. I actually had this very problem today :) – Jeff B Sep 27 '12 at 21:33

1 Answers1

-2

COMP-3 is typically an IBM only method of packed decimal. I have had issues in the past converting the packed decimal on IBM to other formats. I would normally have to pad my destination size by a byte to get the sizes to match up.

I'm not aware of any COMP conversion programs or utilities that would help you on this.

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
  • There are packed decimal forms on many other chipsets and architectures. Motorol 68k and WD65x come to mind. Even the Intel x86 line has packed support. – Joe Zitzelberger Feb 21 '12 at 16:33
  • That wasn't what the question was. He is asking for a conversion tool to do it for him. And COMP-3 is an IBM compiler only version of packed decimal. You won't find COMP-3 anywhere else. That doesn't mean packed decimal doesn't exist, just not COMP-3. – Bill Burgess Feb 21 '12 at 22:14
  • COMP-3 is just a spelling. PACKED-DECIMAL is an equally acceptable spelling in IBM's Enterprise COBOL. You may have padded in the past, but can't think why.IBM data from a COBOL program *may* (but not really very likely) give some extra sign possibilities. Using those possibilities going the other way may stuff something up. – Bill Woodger Dec 16 '13 at 23:39