Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

ZD computation, signed lost for positives

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: ZD computation, signed lost for positives
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: 2150
Location: At my coffee table

PostPosted: Wed Oct 10, 2007 3:36 pm    Post subject: Re: ZD computation, signed lost for positives
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Wed Oct 10, 2007 5:13 pm    Post subject: Reply to: ZD computation, signed lost for positives
Reply with quote

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

Senior Member


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

PostPosted: Wed Oct 10, 2007 5:59 pm    Post subject:
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

Site Director


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

PostPosted: Wed Oct 10, 2007 6:27 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Oct 10, 2007 7:00 pm    Post subject:
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

Site Director


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

PostPosted: Wed Oct 10, 2007 7:05 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed Oct 10, 2007 10:36 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

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


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us