Page 1 of 1

Conversion ZD to PD signed

PostPosted: Mon Jun 20, 2011 3:20 pm
by pixel
Hi man!
Sorry for my english, i'am Fulvio, an italian boy.
My problem is the converion of a nombre signed from zoned to packed.
The input dataset is formed with matric and nombre:
( Ex. BH00001-00000160946)
BH00001 : MATRIC
-00000160946 : nombre -1609,46

I use this way:
OPTION COPY
OUTREC FIELDS=(1,7,
08,11,ZD,TO=PD,LENGTH=6)

but the result is :
BH02131 -m%
CCFFFFF444444000096
280213100000000164C

while I would like this:
BH02131 -m%
CCFFFFF444444000096
280213100000000164D

Thanks for your attention

Re: Conversion ZD to PD signed

PostPosted: Mon Jun 20, 2011 9:20 pm
by Akatsukami
Note that this is not a JCL question, but a *sort question, and ought therefore to have been posted in either the DFSORT or Syncsort forum, depending on which product your site uses.

That having been said, I think that you want to specify the input field as "LS" (zoned decimal with separate leading sign) rather than "ZD". It should be noted, though, that I am not a *sort maven; if another person corrects me, you should certainly use that correction.

Re: Conversion ZD to PD signed

PostPosted: Mon Jun 20, 2011 10:06 pm
by steve-myers
The first problem you have is terminology. It helps us if you use the correct English words. The other issue is you do not fully understand the idea of a zoned decimal number: -00000160946 is not a valid zoned decimal number.

In a valid zoned decimal number the sign is in the high order 4 bits of the last digit. D (1101) is the most common indication of negative number. You have F (1111) which is an alternate indication of a positive number. The bit combinations in the high order 4 bits of the last byte are the same as the low order 4 bits of a packed decimal number. This confusing mess goes back to card sorting machines and the way they worked, and the way the EBCDIC character set was implemented so that cards could be read into the machine with intact signs. This link discusses the zoned decimal format.

The codes you show appear to indicate the - sign was not translated, or it was made 0 because it is invalid.

As Akatsukami says, this is not a JCL question; it should be raised in sort forums where conversions can be discussed in greater detail.

Re: Conversion ZD to PD signed

PostPosted: Mon Jun 20, 2011 10:38 pm
by Frank Yaeger
Fulvio,

It appears you have an a 12-byte SFF numeric value in positions 8-19, so the correct DFSORT control statements would be:

   OPTION COPY                     
   OUTREC FIELDS=(1,7,             
     08,12,SFF,TO=PD,LENGTH=6)     


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080

Re: Conversion ZD to PD signed

PostPosted: Wed Jun 22, 2011 3:55 pm
by pixel
Thanks for your answers, I will follow your advice.
Write the problem in the appropriate section.