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 SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am


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