Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
julienloc

New User

Joined: 17 Aug 2007
Posts: 29
Location: Brussels

Posted: Wed Oct 10, 2007 3:24 pm    Post subject: ZD computation, signed lost for positives

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

CICS Guy

Senior Member

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

Posted: Wed Oct 10, 2007 3:36 pm    Post subject: Re: ZD computation, signed lost for positives

 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.......
julienloc

New User

Joined: 17 Aug 2007
Posts: 29
Location: Brussels

 Posted: Wed Oct 10, 2007 4:53 pm    Post subject: 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
enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10396
Location: italy

 Posted: Wed Oct 10, 2007 5:13 pm    Post subject: Reply to: ZD computation, signed lost for positives The ultimate authority is the "... PRINCIPLES OF OPERATIONS" [url] http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/8.1.3?SHELF=HAS1BK04&DT=19970613131822[/url] at the chapter decimal codes
CICS Guy

Senior Member

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

Posted: Wed Oct 10, 2007 5:59 pm    Post subject:

 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.......
dick scherrer

Site Director

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

 Posted: Wed Oct 10, 2007 6:27 pm    Post subject: 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. . .
julienloc

New User

Joined: 17 Aug 2007
Posts: 29
Location: Brussels

 Posted: Wed Oct 10, 2007 6:46 pm    Post subject: 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.
julienloc

New User

Joined: 17 Aug 2007
Posts: 29
Location: Brussels

 Posted: Wed Oct 10, 2007 6:52 pm    Post subject: 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.
CICS Guy

Senior Member

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

Posted: Wed Oct 10, 2007 7:00 pm    Post subject:

 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.
dick scherrer

Site Director

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

 Posted: Wed Oct 10, 2007 7:05 pm    Post subject: 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.
julienloc

New User

Joined: 17 Aug 2007
Posts: 29
Location: Brussels

 Posted: Wed Oct 10, 2007 8:51 pm    Post subject: Dick, thanks. My DFSORT job is then adequate. CICS guy, you're right, didn't see it like that. Thanks again for everything. Julien
Frank Yaeger

DFSORT Moderator

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

Posted: Wed Oct 10, 2007 10:36 pm    Post subject:

 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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics SIGNED DECIMAL TO COMP-3 using cobol ... ram_vizag COBOL Programming 1 Tue Mar 01, 2016 11:32 pm Adding negatives and positives separa... hiravibk DFSORT/ICETOOL 6 Sat Nov 07, 2015 2:58 am How to convert unsigned numeric to si... mftechie123 SYNCSORT 7 Thu Jan 29, 2015 4:54 pm Issue in Comparing 2 Signed Comp Vari... elango Paulraj COBOL Programming 4 Thu Jan 08, 2015 1:55 pm Obtaining a signed value when updatin... Shrikant Kumar DFSORT/ICETOOL 2 Wed Dec 24, 2014 11:04 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us