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

Author Message
anky.1987

New User

Joined: 09 Sep 2010
Posts: 2
Location: Chennai

Posted: Thu Jul 26, 2012 12:36 am    Post subject: Reply to: Signed decimal sum using DFSORT

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.

anky.1987

New User

Joined: 09 Sep 2010
Posts: 2
Location: Chennai

 Posted: Thu Jul 26, 2012 12:53 am    Post subject: I just had it correct using below: SORT FIELDS=(1,1,CH,A) INREC BUILD=(45:21,08) SUM FIELDS=(45,8,ZD)
Skolusu

Senior Member

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

Posted: Thu Jul 26, 2012 2:03 am    Post subject: Reply to: Problem with signed zoned decimal

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
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Having a problem FTP'ng to the MF pahiker All Other Mainframe Topics 2 Fri Nov 10, 2017 8:20 pm Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am

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