Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN ENDSCAN with INSERT statment...
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
SCAN ENDSCAN with INSERT statment...
Environment versions
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00965286
Message ID:
00965286
Views:
45
While investigating some scary VFP code for a data production problem I came across the following :
SELECT MyTable
SCAN
  SCATTER TO laArray
  FOR x=1 TO 9
    DO CASE
      CASE x=1 AND ...
        laArray[22]=laArray[22]+"SA"
        INSERT INTO MyTable FROM ARRAY laArray

      CASE X=2 AND ...
        laArray[22]=laArray[22]+"GA"
        INSERT INTO MyTable FROM ARRAY laArray

      CASE x=3 AND ...
        laArray[22]=laArray[22]+"MF"
        INSERT INTO MyTable FROM ARRAY laArray

    ENDCASE
  ENDFOR

*** Process MyTable 

ENDSCAN
The cause of the problem is the records INSERTED during the scan are never processed. Walking through the code in the DEBUGGER shows the MyTable hits EOF when on the record that was the last record when the SCAN started. I could reproduce the problem VFP 8 and VFP 9 earlier this week at the office. Support is upgrading production code to VFP 8.0 so I thought it was a upgrade problem but they assured me the problem began BEFORE the upgrade was put in place. Well tonight I just ran the same code in VFP 6 SP5 thinking it would work but that is not the case. Walking through the DEBUGGER I get the same results as I do in VFP 8 and VFP 9.

The troubling part is this code has been running and working in a high-volume, production environment since 2000. The problem started on November 8th and production support has not been able to solve the problem so I was asked me to investigate.

Maybe VFP 6.0 worked before installing the VFP 8.0 runtimes? I don't know all the update details of when, what and who yet.

Any ideas?

Thanks!
Heavy Metal Pedal - click with care
Next
Reply
Map
View

Click here to load this message in the networking platform