I use DFSORT to perform some computations on zoned decimal data (ZD).
Using MULT, DIV or TOT, the result is correct when it comes to negative results, that is, the first part of the last byte is X'D'.
It is supposed that for a positive number the first part of the last byte is X'C'. But for positive numbers I loose this encoding, the first part of the last byte get transformed into X'F', that is, an unsigned zoned decimal.
If this is the case, that's ok.
Surfing the net, that's not what I had found, but may be I was not on the right page. Any official page describing the formats?
I would like to be sure that further processing of the data by other applications expecting signed ZD will not have any problem.
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
julienloc wrote:
If this is the case, that's ok.
Surfing the net, that's not what I had found, but may be I was not on the right page. Any official page describing the formats?
If you can't believe DFSort, who else is there.......
DFSORT Data Formats
It might be unfounded, but I keep thinking there is a sort option or parameter that governs the embedded sign behavior.....I haven't had any luck (yet) finding it.......
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Keep in mind that while the "C" sign and the "F" sign are both "positive" in a computation, they are not the same if that data should ever be used as a key. . . This has "surprised" people in vsam, db2, and other places. . .
The thing is that I have to further processing this data with a COBOL program. In the COBOL program I should declare the variable as signed number (PIC S...), so I wonder if this will work with the F.. as first part of the last byte.
What do you think?
Thanks for all your answers. I'll check the references.
In DFSORT data formats, the explanation does not refer to 'F' for positives.
It says: "The overpunch sign bit is always 'C' for positive and 'D' for negative".
But in Principles of Operation, I can see that 'F' and 'C' are equivalent.
So basically, I think it's a lack of documentation in DFSORT.
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
julienloc wrote:
In DFSORT data formats, the explanation does not refer to 'F' for positives.
It says: "The overpunch sign bit is always 'C' for positive and 'D' for negative".
Did you notice the Notes:
1. The following are treated as positive sign indicators: F, E, C, A, 8, 6, 4, 2, 0.
2. The following are treated as negative sign indicators: D, B, 9, 7, 5, 3, 1.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
use DFSORT to perform some computations on zoned decimal data (ZD).
Using MULT, DIV or TOT, the result is correct when it comes to negative results, that is, the first part of the last byte is X'D'.
It is supposed that for a positive number the first part of the last byte is X'C'. But for positive numbers I loose this encoding, the first part of the last byte get transformed into X'F', that is, an unsigned zoned decimal.
Is there a way to have my X'C' back?
For TO=ZD or TO=ZDF, DFSORT uses an F sign for ZD.
If you want a C sign for ZD, you can use TO=ZDC.
C and F are both valid plus signs for ZD.
Quote:
So basically, I think it's a lack of documentation in DFSORT.
It's all documented under p,m,f,fo - it discusses ZD, ZDF and ZDC and says among other things:
For ZD or ZDF output, F is used as the positive sign and D is used as the negative sign. For ZDC output, C is used as the positive sign.