chandrakanth_s
New User
Joined: 15 Mar 2006 Posts: 13
|
|
|
|
Hi,
I would like to aggregate Products field based on Dept. I tried using sum fields control statement. But I am getting SOC7 since there is the Products field. DEPT is a 4 byte field and Products is a 10 byte field, Out of 10 fields only two fields have decimal values the rest 8 bytes are spaces.
Expected Output is given below
Input:
Code: |
Dept Products
----------------
0001 11
0001 91
0002 11
0002 11
0003 81
0003 11
0003 11
|
Output
Code: |
0001 102
0002 022
0003 103
|
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If your amount field is right-aligned, then you could use the following DFSORT statements and you wouldn't get an S0C7.
Code: |
OPTION ZDPRINT
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=(5,10,ZD)
|
However, the output would not be what you want. It would be:
Code: |
00010000000102
00020000000022
00030000000103
|
To get what you want you could use these DFSORT statements:
Code: |
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=(5,10,ZD)
OUTREC OVERLAY=(5:5,10,ZD,EDIT=(IIIIIIITTT))
|
The output would be:
Code: |
0001 102
0002 022
0003 103
|
|
|