Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

conversion from decimal to packed BCD

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there some java library or method that handles conversion from decimal to packed BCD and vice versa? I am supposed to write code that does that.

Thanks
val
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

I'm not aware of anything to do that, but you could Google and see. I haven't looked to see the real definition of BCD ... are you converting to/from IBM mainframes where 123 would be, um, x'f123'? We've had other questions about that in the past ... you might try the ranch search tool on the first few Java In General forums and see what you hit.
 
Valerie Waters
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply!!
I was wondering if there's a Java routine/method that handles BCD to decimal conversion and/or vice versa. I did not get much help from the searching the forums...
 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try using the AS400PackedDecimal class from "IBM Toolbox for Java".
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ic2924/info/rzahh/javadoc/com/ibm/as400/access/AS400PackedDecimal.html

You can download opensource version of these classes from here.
http://jt400.sourceforge.net/

James.
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We use the mentioned approach (not surprisingly as we implement for the AS400 system). For converting we use the (among others) AS400DataType and the AS400PackedDecimal.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic