View previous topic :: View next topic
|
Author |
Message |
pnr kishore
New User
Joined: 29 May 2008 Posts: 15 Location: CHENNAI
|
|
|
|
hi
Can Any one help me in addressing the issue related to summing of the fields using sum fields option in sort.
I have a file with three columns as shown below
Code: |
62152115 +72.000 16109
62152115 -24.000 16109
62152115 24.000 16448
62152115 24.000 19177
62152115 48.000 19208
62152115 24.000 19213
62152115 24.000 19244
62152115 +120.000 16109 |
and i need to add the column 2 records when the column1 and column3 combinations are repeated
For instance : for this input
62152115 72.000 16109
62152115 -24.000 16109
in the output i need only one record that should have
Code: |
62152115 48.000 16109 |
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
what about this line ?
Code: |
62152115 +120.000 16109 |
Gerry |
|
Back to top |
|
|
pnr kishore
New User
Joined: 29 May 2008 Posts: 15 Location: CHENNAI
|
|
|
|
hi,
Even this Record has to be accounted . For Better understanding i have take only two records to illustrate my requirement.
Quote: |
For instance : for this input
62152115 72.000 16109
62152115 -24.000 16109
in the output i need only one record that should have
62152115 48.000 16109 |
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
62152115 +72.000 16109
62152115 -24.000 16109
62152115 24.000 16448
62152115 24.000 19177
62152115 48.000 19208
62152115 24.000 19213
62152115 24.000 19244
62152115 +120.000 16109
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC OVERLAY=(21:21,9,SFF,TO=ZD,LENGTH=9)
SORT FIELDS=(1,8,CH,A,44,5,CH,A)
SUM FIELDS=(21,9,ZD)
OUTREC OVERLAY=(21:21,9,ZD,EDIT=(SIIIT.TTT),SIGNS=(+,-))
/*
|
SORTOUT would have:
Code: |
62152115 +168.000 16109
62152115 +24.000 16448
62152115 +24.000 19177
62152115 +48.000 19208
62152115 +24.000 19213
62152115 +24.000 19244
|
|
|
Back to top |
|
|
pnr kishore
New User
Joined: 29 May 2008 Posts: 15 Location: CHENNAI
|
|
|
|
Thanks Alot
it worked for me... |
|
Back to top |
|
|
|