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
 

 

Doubt in SUM FIELDS in SORT utilty

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
callkris_cit

New User


Joined: 22 Apr 2006
Posts: 44

PostPosted: Mon Oct 09, 2006 12:36 pm    Post subject: Doubt in SUM FIELDS in SORT utilty
Reply with quote

Hi All,
I have the below input file
1- 6 Indicates Name, 7 - 9 Indicates Amount

Sample input file:
RAMESH100
SURESH090
RAMESH999
SURESH090
I want to add the amounts if the names are equal. Hence i specified the below SORT card
SORT FIELDS=(1,6,CH,A)
SUM FIELDS=(7,3,ZD)
My output is:
RAMESH099 -> Incorrect because it should be RAMESH1099 ( In
this 1099 displayd as 099 )
SURESH180 -> Correct

Please let me know how to get the 1099 value for first record. Is there any option is there to get the correct value.

I need a output like below:
RAMESH1099
SURESH0180

Thanks in advance,
Suresh
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Mon Oct 09, 2006 8:56 pm    Post subject:
Reply with quote

The problem here is that your 3-digit values are overflowing the 3-digit field. You need to "fix" the overflow by using 4-digit values. Here's a DFSORT job that will do that:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/9)
//SORTOUT DD DSN=...  output file (FB/10)
//SYSIN    DD    *
* Add '0' before 3-digit value to get 4-digit value.
  INREC FIELDS=(1,6,C'0',7,3)
  SORT FIELDS=(1,6,CH,A)
  OPTION ZDPRINT
* Sum on 4-digit value.
  SUM FIELDS=(7,4,ZD)
/*
Back to top
View user's profile Send private message
callkris_cit

New User


Joined: 22 Apr 2006
Posts: 44

PostPosted: Tue Oct 10, 2006 10:47 am    Post subject: Re: Doubt in SUM FIELDS in SORT utilty
Reply with quote

Thanks a lot

Regards,
Suresh
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 SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


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