wood burning stoves 2.0*
The moose likes Java in General and the fly likes conversion from decimal to packed BCD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "conversion from decimal to packed BCD" Watch "conversion from decimal to packed BCD" New topic
Author

conversion from decimal to packed BCD

Valerie Waters
Greenhorn

Joined: May 02, 2005
Posts: 3
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
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Valerie Waters
Greenhorn

Joined: May 02, 2005
Posts: 3
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...
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
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.
bart zagers
Ranch Hand

Joined: Feb 05, 2003
Posts: 234
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.
 
Don't get me started about those stupid light bulbs.
 
subject: conversion from decimal to packed BCD
 
Similar Threads
Need help understanding BCD encoding
Using Comp-3 value in Java
BCD to decimal and viceversa
Packed decimal conversion - Java
ASCII TO EBCDIC conversion preserving COMP-3