Removing multiple occur same values and summing other value



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Removing multiple occur same values and summing other value

Postby lamrin » Wed Jun 17, 2009 10:46 pm

can any one help me out in the below scenario

Input file format as below

Transition No price
=========== =====
1000 150.00
1000 250.00
1000 50.00
2000 150.00
2000 300.00
3000 500.00
3000 200.00
4000 250.00

and output should be as below

Transition No price
=========== =====
1000 450.00
2000 450.00
3000 700.00
4000 250.00

Need to sum the price and at same time need to remove the corresponding multiple transition no to single trans no.

Thanks,
Nirmal
lamrin
 
Posts: 1
Joined: Wed Jun 17, 2009 10:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Removing multiple occur same values and summing other value

 

Re: Removing multiple occur same values and summing other value

Postby Frank Yaeger » Wed Jun 17, 2009 11:40 pm

You can use a DFSORT job like the following to do what you asked for:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1000                  150.00
1000                  250.00
1000                   50.00
2000                  150.00
2000                  300.00
3000                  500.00
3000                  200.00
4000                  250.00
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,4,
      TRAILER3=(1,4,22:TOT=(22,7,UFF,EDIT=(IIIT.TT))))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post