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
 

 

Problem with signed zoned decimal

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Reply to: Signed decimal sum using DFSORT
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    Post subject:
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    Post subject: Reply to: Problem with signed zoned decimal
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    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 SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm


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