T.R | Title | User | Personal Name | Date | Lines |
---|
460.1 | define a dupe field | KAHALA::FOREMAN | Nothings Impossible, you just run out of time | Fri Sep 20 1991 16:15 | 12 |
| Well, I guess one way to do it would be ...
Assuming the file is sorted in part-number order
Define a field DUP_FLAG/A1 = IF PART_NUMBER EQ LAST PART_NUMBER THEN
'Y' ELSE 'N';
Then you could print all the part_numbers with a DUP_FLAG of 'Y'.
If you'd expect more than 2 records for each part you'd have to use
sum to just print the duplicate parts once on the report.
Sharon
|
460.2 | Maybe I missed something | CSLALL::COLBERT | | Fri Sep 20 1991 16:44 | 5 |
| I gave this a try, but it still select all records.
I defined the new field then
Print....
IF newfield eq 'Y'
|
460.3 | Always miss something in translation | KAHALA::FOREMAN | Nothings Impossible, you just run out of time | Fri Sep 20 1991 16:55 | 3 |
| Yup, that's what I meant to say. Guess I didn't explain it well enough.
Sharon
|
460.4 | Not sure if you got it to work .. | KAHALA::FOREMAN | Nothings Impossible, you just run out of time | Fri Sep 20 1991 17:21 | 26 |
| Wasn't quite sure of the question, but that solution should have worked
if you're sure the file you're reading is already sorted in part-number
order. Could it be that every part-number has a duplicate record ?
Another way to do it so you could tell how many records each part
number had ( if you need to know such a thing ) :
DEFINE FILE PARTLIST
REC_CNT/I6 = 1;
END
TABLE FILE PARTLIST
SUM PART_NUMBER REC_CNT BY PART_NUMBER NOPRINT
ON TABLE HOLD
END
To find the ones with more than one record ...
TABLE FILE HOLD
PRINT PART_NUMBER
IF REC_CNT GT 1
END
Hope I answered the question this time.
Sharon
|
460.5 | IF TOTAL does the trick | RDGE88::KEEGAN_9 | | Mon Sep 23 1991 03:46 | 35 |
| If you just want to see a list of the duplicate records, then ...
TABLE FILE X
COUNT ENTRIES BY FIELDNAME
IF TOTAL COUNT GT 1
(ON TABLE SAVE AS LOOKUP)
END
will give a sorted list of values, with their frequency.
Should you wish to extract data based on this output then you'll need
to include the ON TABLE SAVE line and use either
TABLE FILE X }
IF FIELDNAME EQ (LOOKUP) } if LOOKUP 'relatively' small
PRINT ... }
or
DEFINE FILE X }
OK/I1 = DECODE FIELDNAME(LOOKUP ELSE 1); }
END } if LOOKUP 'relatively' large
TABLE FILE X } (see earlier notes on
IF OK EQ 0 } "look-up tables")
PRINT ... }
The result is the same as Sharon's, but gets there one step quicker.
Kind regards,
Paul K
|