Packed Decimal for Z/Series Mainframe in Java

Discussions regarding Open Source Java projects under z/OS (other than Tomcat)
Post Reply
bjwhite66212
Posts: 6
Joined: Wed Aug 09, 2006 2:43 pm
Location: United States

Packed Decimal for Z/Series Mainframe in Java

Post by bjwhite66212 »

Open source Java package for packed decimal conversion to and from Java long and String:

http://www.benjaminjwhite.name/zdecimal
dovetail
Site Admin
Posts: 2006
Joined: Thu Jul 29, 2004 12:12 pm

Post 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.
bjwhite66212
Posts: 6
Joined: Wed Aug 09, 2006 2:43 pm
Location: United States

Post 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.
ndefreitas
Posts: 3
Joined: Tue Jul 10, 2007 4:05 pm

MIPS GP/ZAAP

Post 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
dovetail
Site Admin
Posts: 2006
Joined: Thu Jul 29, 2004 12:12 pm

Post 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?
ndefreitas
Posts: 3
Joined: Tue Jul 10, 2007 4:05 pm

IFACrossOver

Post 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
Cogito-Ergo-Sum
Posts: 30
Joined: Thu Jan 25, 2007 8:31 am
Location: Bengaluru, India

Post by Cogito-Ergo-Sum »

Hi,
I am not able to get to the site - 'HTTP 404'. Can someone please give me the right URL ?
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
--Sherlock Holmes
dovetail
Site Admin
Posts: 2006
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

What site are you trying to get to? dovetail.com is up.
Cogito-Ergo-Sum
Posts: 30
Joined: Thu Jan 25, 2007 8:31 am
Location: Bengaluru, India

Post 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
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
--Sherlock Holmes
dovetail
Site Admin
Posts: 2006
Joined: Thu Jul 29, 2004 12:12 pm

Post 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.
Cogito-Ergo-Sum
Posts: 30
Joined: Thu Jan 25, 2007 8:31 am
Location: Bengaluru, India

Post 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...
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
--Sherlock Holmes
Cogito-Ergo-Sum
Posts: 30
Joined: Thu Jan 25, 2007 8:31 am
Location: Bengaluru, India

Post 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.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
--Sherlock Holmes
dovetail
Site Admin
Posts: 2006
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

When writing a field, 0C and 0D are used.
When reading, 0B and 0D are taken as negative, others as positive.
Post Reply