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

changing the sign internally.


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

New User


Joined: 06 Apr 2006
Posts: 31

PostPosted: Tue Jun 06, 2006 6:59 pm
Reply with quote

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.
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: Tue Jun 06, 2006 9:47 pm
Reply with quote

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))
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 changing defaults in db2 admin - Unlo... DB2 0
No new posts Tilde Characters Changing to COLONs i... CLIST & REXX 22
No new posts Changing Data Type SYNCSORT 4
This topic is locked: you cannot edit posts or make replies. Missing Negative sign in COBOL COBOL Programming 6
No new posts SUSBSCRIPT WITH SIGN IN PIC CLAUSE COBOL Programming 3
Search our Forums:

Back to Top