IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Doubt in SUM FIELDS in SORT utilty


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Mon Oct 09, 2006 8:56 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top