>LOCAL cCNTID1, cCNTID2, cCMPID1, cCMPID2 >cCNTID1 = "" >cCNTID2 = "" >cCMPID1 = "" >cCMPID2 = "" >USE C:\MVS\MS_8021.DBF && OPEN TABLE >SET ORDER TO 3 && Indexed on CNT_ID - the field to check for duplicates >SET TEXTMERGE TO C:\MVS\MS_8021DUP.TXT && Open the text output file >SET TEXTMERGE ON NOSHOW && Turn on the textmerge capability w/o console output >LOCATE && GO TOP >SCAN > * Capture the values in the current record for comparison with the next > cCNTID1 = CNT_ID > cCMPID1 = CMP_ID > cRECORD1 = STR(RECNO(),5,0) > SKIP && move to the next record > IF CNT_ID = cCNTID1 && make the comparison > * if values the same output the values from each record > TEXT > <<cRECORD1>> / <<cCMPID1>> / <<cCNTID1>> / <<STR(RECNO(),5,0)>> / <<CMP_ID>> / <<CNT_ID>> > ENDTEXT > ENDIF > SKIP -1 && move the record pointer back to previous record > * because SCAN will do a skip forward to evaluate the next two >ENDSCAN >SET TEXTMERGE OFF