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

Compare with the same dataset and use add operation


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shamsundar_mk

New User


Joined: 18 May 2007
Posts: 30
Location: CHENNAI

PostPosted: Thu May 03, 2012 1:02 pm
Reply with quote

Hi,
Could you please help me!

I have a input file as below.


Code:
hdr this is header record       
det spart1                   10
det spart1                   10
det spart2                   05
det spart2                   11
det spart1                   12
det spart2                   15
trl this is trailer record   


my output file should remove the duplicates in detail record (det) and add the count as below

Code:
hdr this is header record       
det spart1                   32
det spart2                   31
trl this is trailer record
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu May 03, 2012 1:05 pm
Reply with quote

So you need to SUM the values, excluding the header and trailer. Do you need any changes to the header/trailer?
Back to top
View user's profile Send private message
shamsundar_mk

New User


Joined: 18 May 2007
Posts: 30
Location: CHENNAI

PostPosted: Thu May 03, 2012 1:12 pm
Reply with quote

No! I need the header and trailer as it is in input file.
and the sum of the duplicates as said above.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu May 03, 2012 1:50 pm
Reply with quote

Hey, what is all the "shrieking" about? I just asked a question.

There are manuals for DFSORT/ICETOOL, links in this forum, links at the top of the page. Your task is absurdly easy, and I apologise for assuming that there must be something else to it for you not to be able to achieve the results without asking here.

For me, you are on your own with this one. Should take all of five minutes.

!
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Thu May 03, 2012 8:24 pm
Reply with quote

shamsundar_mk,
Here is a job from Smart DFSORT Tricks.... I modified to add sum fields statement... Keep in mind, if your total is likely to go beyond 99, you will need to handle that.

Code:
//S1       EXEC PGM=ICETOOL                         
//TOOLMSG  DD SYSOUT=*                               
//DFSMSG   DD SYSOUT=*                               
//IN DD *                                           
HDR THIS IS HEADER RECORD                           
DET SPART1                   10                     
DET SPART1                   10                     
DET SPART2                   05                     
DET SPART2                   11                     
DET SPART1                   12                     
DET SPART2                   15                     
TRL THIS IS TRAILER RECORD                           
/*                                                   
//OUT DD SYSOUT=*                                   
//TOOLIN DD *                                       
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)
//CTL1CNTL DD *                                     
 SORT FIELDS=(1,3,CH,A,5,6,CH,A)                     
 SUM FIELDS=(30,2,ZD)                               
/*                                                   

OUTPUT
Code:

HDR THIS IS HEADER RECORD     
DET SPART1                   32
DET SPART2                   31
TRL THIS IS TRAILER RECORD     

Thanks,
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 FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top