Page 1 of 1

Packed Decimal for Z/Series Mainframe in Java

Posted: Mon Sep 04, 2006 10:20 am
by bjwhite66212
Open source Java package for packed decimal conversion to and from Java long and String:

http://www.benjaminjwhite.name/zdecimal

Posted: Wed Sep 06, 2006 3:37 pm
by dovetail
Looks nice.

(Only a suggestion) You might also want to consider supporting conversions to/from java.math.BigDecimal, and maybe zoned decimal fields.

Posted: Thu Sep 07, 2006 7:28 pm
by bjwhite66212
Zoned decimal sounds like a good idea.

BigDecimal has a constructor that accepts Java String and a toString method. Z Decimal converts packed to and from String.

MIPS GP/ZAAP

Posted: Tue Jul 10, 2007 4:18 pm
by ndefreitas
BJ,
Thanks for putting this together - we use it at my company.

The only thing is we have a job which needs to process several million records and for some reason when we use the PackDec.stringToPack(str,b,offset,size); we see a significant increase GP usage. Any ideas on how we can offload some of this processing to ZAAP. I'm assuming that some of the code in this method is invoking native functions, and that's why we're seeing higher GP usage.

Thanks

Nigel

Posted: Fri Jul 13, 2007 5:34 pm
by dovetail
I looked at the source (included in the jar) and its 100% java.
Are you sure that your other processing isn't what is accouting for GP time?

Of course, zAAP is a bit tricky... just because something is eligible doesn't mean that it will actually use zAAP. Could that be the problem?

IFACrossOver

Posted: Fri Jul 13, 2007 7:50 pm
by ndefreitas
You are correct. It turns out that when we upgraded to WAS 6.1 on z/OS it did not have enough mips to start all the servers, so our WAS admins switched the IFACrossOver to Yes. This is what caused lots of zAAP eligible processor requests to be taken off the work request queue from the GP.

Thanks.

Nigel

Posted: Thu Sep 27, 2007 8:29 pm
by Cogito-Ergo-Sum
Hi,
I am not able to get to the site - 'HTTP 404'. Can someone please give me the right URL ?

Posted: Fri Sep 28, 2007 8:09 am
by dovetail
What site are you trying to get to? dovetail.com is up.

Posted: Fri Sep 28, 2007 11:04 am
by Cogito-Ergo-Sum
If it were down, I would not have been able to post the message, would I ? :D

I meant this : http://www.benjaminjwhite.name/zdecimal

Posted: Fri Sep 28, 2007 12:27 pm
by dovetail
The link works for me.

You might also want to look at the latest version of JZOS on alphaWorks. It contains a complete set of field converters for Cobol data types.

http://www.alphaworks.ibm.com/tech/zosjavabatchtk

In the included samples, there is example code for a Java class that maps a Cobol copy book.

Posted: Sun Sep 30, 2007 12:16 am
by Cogito-Ergo-Sum
It is opened now...dunno what happened then.

Yes, I am aware of the mapping facility. JZOS has one for Assembler DSECTs too as well, isn't it ? Been itchin' to use it...

Posted: Mon Oct 22, 2007 4:41 am
by Cogito-Ergo-Sum
In the javadoc,
Decimal digits are stored as 4 bits, 0 through 9, two digits per byte. The last four bits of a number are reserved for a sign. Positive are binary 1010, 1100 1110 and 1111. Negative is 1011 and 1101. For example the number -354 woud be stored as 0x354d, 7251 would be stored 0x07251c.
does it mean, the lower nibble is always d for negative and c for positive ?

I think, that is being too restrictive.

Posted: Mon Oct 22, 2007 8:20 am
by dovetail
When writing a field, 0C and 0D are used.
When reading, 0B and 0D are taken as negative, others as positive.