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 » Mon Sep 04, 2006 10:20 am

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

http://www.benjaminjwhite.name/zdecimal

dovetail
Site Admin
Posts: 1850
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail » Wed Sep 06, 2006 3:37 pm

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 » Thu Sep 07, 2006 7:28 pm

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 » Tue Jul 10, 2007 4:18 pm

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: 1850
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail » Fri Jul 13, 2007 5:34 pm

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 » Fri Jul 13, 2007 7:50 pm

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 » Thu Sep 27, 2007 8:29 pm

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: 1850
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail » Fri Sep 28, 2007 8:09 am

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 » Fri Sep 28, 2007 11:04 am

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: 1850
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail » Fri Sep 28, 2007 12:27 pm

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 » Sun Sep 30, 2007 12:16 am

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 » Mon Oct 22, 2007 4:41 am

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: 1850
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail » Mon Oct 22, 2007 8:20 am

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

Post Reply