IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ZD computation, signed lost for positives


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Oct 10, 2007 3:24 pm
Reply with quote

Hi all,

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.

Is there a way to have my X'C' back?

Here examples of what I do:

Code:
OVERLAY=(2:43,13,20:(20,9,ZD,MUL,56,9,ZD),DIV,+1000,TO=ZD))


or

Code:
OUTFIL REMOVECC,NODETAIL,                             
  SECTIONS=(1,19,                                     
    TRAILER3=(15,5,2,13,19:TOT=(23,12,ZD,TO=ZD),35,8))



Thank you very much.

Julien
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Oct 10, 2007 3:36 pm
Reply with quote

julienloc wrote:
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.
Just a point, that is not unsigned ZD, the F is the same as C, a positive value.......
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Oct 10, 2007 4:53 pm
Reply with quote

Hi Cics guy,

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.

Thanks.

Julien
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Oct 10, 2007 5:13 pm
Reply with quote

The ultimate authority is the "... PRINCIPLES OF OPERATIONS"
[url]
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/8.1.3?SHELF=HAS1BK04&DT=19970613131822[/url]
at the chapter decimal codes
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Oct 10, 2007 5:59 pm
Reply with quote

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.......
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Oct 10, 2007 6:27 pm
Reply with quote

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. . .
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Oct 10, 2007 6:46 pm
Reply with quote

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.
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Oct 10, 2007 6:52 pm
Reply with quote

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.

Great news is that my data is not corrupted :-)

Thanks guys for the support.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Oct 10, 2007 7:00 pm
Reply with quote

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.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Oct 10, 2007 7:05 pm
Reply with quote

Hello,

If the numbers are to be used in arithmetic operations in the COBOL code, it will work. Both the "F" and "C" sign will be positive.
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Oct 10, 2007 8:51 pm
Reply with quote

Dick, thanks. My DFSORT job is then adequate.
CICS guy, you're right, didn't see it like that.

Thanks again for everything.

Julien
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Oct 10, 2007 10:36 pm
Reply with quote

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.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Numeric check on packed signed and un... COBOL Programming 4
No new posts Signed Count in Trailer SYNCSORT 7
No new posts Cobol redefines for Signed pictured c... COBOL Programming 4
No new posts Display Signed ZD field DFSORT/ICETOOL 11
No new posts Convert alpha numeric to signed digits COBOL Programming 4
Search our Forums:

Back to Top