View previous topic :: View next topic
|
Author |
Message |
shamsundar_mk
New User
Joined: 18 May 2007 Posts: 30 Location: CHENNAI
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
So you need to SUM the values, excluding the header and trailer. Do you need any changes to the header/trailer? |
|
Back to top |
|
|
shamsundar_mk
New User
Joined: 18 May 2007 Posts: 30 Location: CHENNAI
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
|
|