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

Problem with signed zoned decimal


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

New User


Joined: 09 Sep 2010
Posts: 2
Location: Chennai

PostPosted: Thu Jul 26, 2012 12:36 am
Reply with quote

Hi All,

I have a similar req, so thought to post it here itself. I have a PS which has amount field s9(6)v9(2) in below format

Code:
0000400}
0000375G
0000375P


0000375G means 000037.57

I need to sum up those and use that in trailer record. I have tried to use below sysin:
Code:
SORT FIELDS=(1,1,CH,A)                     
INREC BUILD=(45:21,08,SFF,TO=ZD,LENGTH=08)
SUM FIELDS=(45,8,ZD)                       


say the field starts at position 21. This is giving wrong data and not in input format.
Back to top
View user's profile Send private message
anky.1987

New User


Joined: 09 Sep 2010
Posts: 2
Location: Chennai

PostPosted: Thu Jul 26, 2012 12:53 am
Reply with quote

I just had it correct using below:

SORT FIELDS=(1,1,CH,A)
INREC BUILD=(45:21,08)
SUM FIELDS=(45,8,ZD)
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 26, 2012 2:03 am
Reply with quote

anky.1987

Your input is already a zoned decimal number with sign overpunch. Why are you treating it as an Signed Free format and then converting it to ZD? By doing so you are actually loosing the sign. The over punch in hex format looks like this
Code:

{ABCDEFGHI}JKLMNOPQR
01234567890123456789 


Hex C0 thru C9 are positive numbers and D0 thru D9 are negative numbers. The number on top represents the sign overpunch and the lower number represents the readable decimal number

so change your control cards to the following
Code:

//SYSIN    DD *
  OPTION ZDPRINT
  SORT FIELDS=(1,1,CH,A)                     
  SUM FIELDS=(21,8,ZD)
//*


Check this link which explains ZDPRINT effect on SUM statement
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts z/vm installation problem All Other Mainframe Topics 0
Search our Forums:

Back to Top