com.stc.eways.cics
Class PackedDecimal
java.lang.Object
com.stc.eways.cics.DataStructure
com.stc.eways.cics.PackedDecimal
public class PackedDecimal
- extends DataStructure
Constructor Summary |
PackedDecimal(byte[] Packed_Origin,
int Offset,
int IntSize,
int DecSize)
Construct using an existing byte array(Supose to point on
a valid packed decimal format or to be translated later
with toPackedDecimal method |
Method Summary |
static int |
getPackedSize(int intSize,
int decSize)
giving int Size + dec size returns physical size
necessary to store the packed decimal data |
static void |
main(java.lang.String[] Argv)
Just use the main method for Class unit testing |
void |
toPackedDecimal(java.lang.String Number)
Build a packed decimal from a string number
Convert the in String +-99999.99 in an packed decimal IBM data
Flow -> Each digit is a 0..9 Numerical value last digit is the sign
digit : A|C|E|F => + ; B|D => - ; the decimal point is virtual
its position is defined in the second byte of dec_len |
java.lang.String |
toString()
Translate current Packed into a String representation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PackedDecimal
public PackedDecimal(byte[] Packed_Origin,
int Offset,
int IntSize,
int DecSize)
- Construct using an existing byte array(Supose to point on
a valid packed decimal format or to be translated later
with toPackedDecimal method
- Parameters:
Packed_Origin
- byte array containing COBOL packed decimal dataOffset
- offset of packed decimal data in arrayIntSize
- non decimal part sizeDecSize
- decimal part size
getPackedSize
public static int getPackedSize(int intSize,
int decSize)
- giving int Size + dec size returns physical size
necessary to store the packed decimal data
toPackedDecimal
public void toPackedDecimal(java.lang.String Number)
throws java.lang.NumberFormatException
- Build a packed decimal from a string number
Convert the in String +-99999.99 in an packed decimal IBM data
Flow -> Each digit is a 0..9 Numerical value last digit is the sign
digit : A|C|E|F => + ; B|D => - ; the decimal point is virtual
its position is defined in the second byte of dec_len
- Parameters:
Number
- decimal String representation to be converted
- Throws:
java.lang.NumberFormatException
toString
public java.lang.String toString()
- Translate current Packed into a String representation
- Overrides:
toString
in class java.lang.Object
- Returns:
- String representation of packed decimal
main
public static void main(java.lang.String[] Argv)
- Just use the main method for Class unit testing