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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


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