home *** CD-ROM | disk | FTP | other *** search
/ Dr. CD ROM (Annual Premium Edition) / premium.zip / premium / IBMOS2_2 / PMCARDSR.ZIP / detect2.prg < prev    next >
Text File  |  1990-09-24  |  938b  |  18 lines

  1. SET ECHO OFF
  2. SET TALK OFF
  3. ? "Duplicate Record Key Checker"
  4. ACCEPT "Enter database name: " TO dbn       && Input data base name.
  5. USE &dbn                                    && Open data base.
  6. DISP STRU                                   && Display db structure
  7. ACCEPT "Enter field name: " TO fld          && Input name of field
  8. INDEX ON &fld TO tempndx                    && Index data base on field.
  9. DO WHILE .NOT. EOF()                        && Search through data base.
  10.    oldval = &fld                            && Save field value.
  11.    oldrec = recno()                         && Save record number.
  12.    SKIP                                     && Skip to next record.
  13.    IF .NOT. EOF() .AND. oldval = &fld
  14.      SKIP -1                                && Backup to first
  15.      DISPLAY &fld WHILE .NOT. EOF() .AND. oldval = &fld   && Disp em
  16.    ENDIF
  17. ENDDO                                       && Repeat until end file
  18.