>>>>I agree it seems to be something other than command line length, except that even when there is no syntax error in the concatenated string, it generates a syntax error after exceeding a certain length.
>>>
>>>Have you tried to save the command as a file, and use execscript() to run it? How many times does the loop run before it errors?
>>
>>execscript fails at the same length just using the memvar. I would not ever want to create a file to execute for something like this.
>
>You don't need to want to. VFP does that for you. Check your temp folder after each execscript().
That's exactly my point. :) I'm executing a single command, not a block of code. There's no need for a file to be created on disk for a single line of code.
>
>BTW, wasn't it "the length of compiled command" that's limited to 8k? And it seems it reserves some space in it for local numerics, names, repackaging parameters etc, so YMMV. The size of compiled command may not be proportional to the size of its source.
I was able to get this particular replace command length to 8165 bytes and execute it at iteration 115.
ACTIVATE screen
CLEAR
CREATE CURSOR csrTemp (cThisIsAReallyCrazyLongFieldName c(10))
lcCmd = ""
FOR X = 1 TO 1000
STORE lcCmd + "cThisIsAReallyCrazyLongFieldName with cThisIsAReallyCrazyLongFieldName," TO lcCmd
?m.x,LEN(m.lcCmd)
lcCmd2 = LEFT(m.lcCmd,LEN(m.lcCmd)-1)
REPLACE &lcCmd2. IN csrTemp
ENDFOR