PRB: SYS(3) Returns Duplicate Filenames

Last reviewed: June 27, 1995
Article ID: Q114435
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6
  • Microsoft FoxPro for MS-DOS, versions 2.5x, 2.6

SYMPTOMS

The purpose of the SYS(3) function is to return a unique filename when it is called. Under certain circumstances, duplicate names may be returned.

CAUSE

This behavior occurs with some processors that run at high speeds.

RESOLUTION

To avoid this problem, increase the time between calls of the SYS(3) function. For example, add the following line:

   =INKEY(.001)

This command forces FoxPro to wait for .001 seconds before issuing the next command.

MORE INFORMATION

Steps to Reproduce Problem

Create and run the following program:

   SET STATUS BAR OFF
   SET STATUS OFF
   SET TALK OFF
   CLEAR

   CREATE CURSOR systest (naam C(10))
   DO WHILE RECNO() < 1000
      APPEND BLANK
      REPLACE naam WITH SYS(3)
   ENDDO

   NumberOfRecords=RECCOUNT()
   ? STR(NumberOfRecords)
   INDEX ON naam TAG naam UNIQUE
   COUNT TO A
   ?STR(A)
   ?"        ----"
   ?STR(NumberOfRecords-A)

Note that the Total number of records (the first number printed) may differ from the number of unique records (the second number printed).


Additional reference words: FoxDos FoxWin 2.50 2.50a 2.50b 2.60 repeat
identical same duplicate
KBCategory: kbprg kbprb
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.