DOCUMENT:Q151841 21-AUG-1999 [foxpro] TITLE :PRB: FoxPro and Clipper Share the Same DBF Files on a Network PRODUCT :Microsoft FoxPro PROD/VER:2.50 2.50a 2.50b 2.60 2.60a 3.00 OPER/SYS: KEYWORDS:kb3rdparty ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a - Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, 2.5b, 2.6, 2.6a - Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b ------------------------------------------------------------------------------- SYMPTOMS ======== RLOCK() will not function properly when a FoxPro Application and a Clipper Application access the same table simultaneously. CAUSE ===== Both FoxPro and Clipper have their own Locking Mechanism. When applying a lock to a table file on the Network, the function FLOCK() can be recognized by both Foxpro and Clipper; it will return a TRUE (.T.) if the table is locked by any of the applications. The function RLOCK() returns a TRUE only if a particular record of a table is locked by the same application. In other words, if a record was locked by Foxpro, Clipper can still lock the particular record without an error, and it has the same behavior the other way around. RESOLUTION ========== Use FLOCK() instead of RLOCK(). MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- Run the following code in Clipper: ** is a numeric field in a Table USE SHARED GOTO TOP REPLACE WITH 100 && Initial Value of DO WHILE RLOCK() && Record is Locked by Clipper ? WAIT ?Hit a Key ...? TO M.temp ENDDO and Run the following code in FoxPro: USE SHARED GOTO TOP DO WHILE RLOCK() && Record is Locked by Foxpro REPLACE WITH + 1 WAIT ?Hit a Key ...? TO M.temp ENDDO Expected Behavior ----------------- When the above code is executed by Foxpro and Clipper at the same time, the expected behavior is: - Clipper locks the record and displays the value of the field, which is 100. - Foxpro cannot lock the same record, so it will keep on trying to lock the record and will not be able to add 1 to the field. Actual Behavior --------------- - Clipper locks the record and displays the value of the field, which is 100. - FoxPro locks the record successfully and adds 1 to the field. - Press a key on the Clipper machine, and it displays 101. - Press a key on the Foxpro machine, and it locks the record successfully again and adds one more to the field. - Press a key on the Clipper machine, and it displays 102. Additional query words: FoxWin VFoxWin FoxDos ====================================================================== Keywords : kb3rdparty Technology : kbVFPsearch kbAudDeveloper kbFoxproSearch kbZNotKeyword3 kbFoxPro200DOS kbFoxPro250DOS kbFoxPro250aDOS kbFoxPro250bDOS kbFoxPro260DOS kbFoxPro260aDOS kbFoxPro260 kbFoxPro250 kbFoxPro250a kbFoxPro250b kbFoxPro260a kbVFP300 kbVFP300b Version : 2.50 2.50a 2.50b 2.60 2.60a 3.00 ============================================================================= 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. Copyright Microsoft Corporation 1999.