shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Hi,
Below is the Input file FB, LRECL=80
Code: |
090600 -0.43
090600 -0.43
090601 -0.43
090601 -0.43
090601 0.00
090602 -0.43
090602 -0.43
090602 -0.43
090602 -0.43 |
Output:-
Code: |
Summary Report
---------------
Account# Amount Count
-------- ------ -----
090600 -1.28 3
090601 -0.86 2
090602 -1.70 4
------ ---
Total -3.84 9 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You need to work on your arithmetic. The correct output for your input example would be:
Code: |
Summary Report
--------------
Account# Amount Count
-------- ------ -----
090600 -0.86 2
090601 -0.86 3
090602 -1.72 4
----- ------ -----
Total -3.44 9
|
You can use a DFSORT job like the following:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
090600 -0.43
090600 -0.43
090601 -0.43
090601 -0.43
090601 0.00
090602 -0.43
090602 -0.43
090602 -0.43
090602 -0.43
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,6,CH,A)
OUTFIL REMOVECC,NODETAIL,
HEADER2=('Summary Report',/,14'-',2/,
'Account#',12:'Amount',21:'Count',/,
8'-',12:6'-',21:5'-'),
SECTIONS=(1,6,
TRAILER3=(1,6,13:TOT=(18,5,SFF,EDIT=(ST.TT),SIGNS=(,-)),
21:COUNT=(M10,LENGTH=5))),
TRAILER1=(5'-',12:6'-',21:5'-',/,
'Total',
13:TOT=(18,5,SFF,EDIT=(ST.TT),SIGNS=(,-)),
21:COUNT=(M10,LENGTH=5))
/*
|
|
|