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

Author Message
foliater

New User

Joined: 06 Apr 2006
Posts: 31

Posted: Tue Jun 06, 2006 6:59 pm    Post subject: changing the sign internally.

is there any sort utility options to convert Zoned Decimal (Positive Value) to Zoned Decimal (Negative Value).

For eg: Amount field is 21.69 then internally in mainframe it is stored as

 Code: Positive Value is stored as : FFFFFFFFFFF 00000002169 Negative value is stored as : FFFFFFFFFFD 00000002169

i need the Sort utility function to convert the X'F' to X'D' ( Last half byte), hence the Zoned decimal amount field will be converted to Negative amount.

Frank Yaeger

DFSORT Moderator

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

Posted: Tue Jun 06, 2006 9:47 pm    Post subject:

You can do that with DFSORT by multiplying by -1.

Let's assume you have an 11-byte ZD field starting in position 21.

If you only have positive ZD values, you can use:

 Code: OPTION COPY   INREC OVERLAY=(21:21,11,ZD,MUL,-1,TO=ZD,LENGTH=11)

If you have both positive and negative ZD values and you only want to change the positive values to negative values, you can use:

 Code: INREC IFTHEN=(WHEN=(21,11,ZD,GE,+0),         OVERLAY=(21:21,11,ZD,MUL,-1,TO=ZD,LENGTH=11))
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm Hardcoded negative sign value in output scdinesh SYNCSORT 8 Fri Sep 08, 2017 5:28 am Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 5 Sat Aug 19, 2017 2:33 pm BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am

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