Page 1 of 1

Removing multiple occur same values and summing other value

PostPosted: Wed Jun 17, 2009 10:46 pm
by lamrin
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

Re: Removing multiple occur same values and summing other value

PostPosted: Wed Jun 17, 2009 11:40 pm
by Frank Yaeger
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))))
/*