speermb
New User
Joined: 27 Aug 2008 Posts: 30 Location: USA
|
|
|
|
I have a file that I am summing 2 fields and need to keep specific data from field 3, when field 3 is equal to "2". The sum always happens based on key, but if there is 1 record on that key with field3="2" I need to keep the "2" in field3. The only way I can think of is to sum file into 1 file, save all "2" into another file then splice the 2 back together. Is there another way?
Currently, I have code:
| Code: |
SORT FIELDS=(01,04,CH,A,
05,04,CH,A,
09,01,CH,A,
10,01,CH,A,
11,09,CH,A,
20,05,CH,A,
25,10,CH,A)
OUTREC FIELDS=(1,44,
52,52,
+0,TO=PD,LENGTH=9,
+0,TO=PD,LENGTH=9,
104,9,
113,9,
122,4,
C'C',
175X)
SUM FIELDS=(104,9,PD,
113,9,PD) |
Input: (the wanted field is the 2 in the "2C" area)
| Code: |
00462012RC16H45206 436S92012-02-212012-02-21JBSTCV ..LAS VEGAS SANDS CORP .................ýN 1C..
00462012RC16H45206 436S92012-02-212012-02-21JBSTCV ..LAS VEGAS SANDS CORP ......°........ìã.N 2C..
00462012RC16H45206 436S92012-02-212012-02-21JBSTCV ..LAS VEGAS SANDS CORP ..............ì&`)N 2C..
|
Output:
| Code: |
00462012RC16H45206 436S92012-02-212012-02-21..LAS VEGAS SANDS CORP ................................Ñ.&(N 1CC
|
Wanted Output:
| Code: |
00462012RC16H45206 436S92012-02-212012-02-21..LAS VEGAS SANDS CORP ................................Ñ.&(N 2CC
|
|
|