Posted by Barbara Brazil on July 12, 2019 at 07:38:13:
In Reply to: REPLACE Question posted by Jeff on July 11, 2019 at 22:40:03:
Jeff:
The issue is related to this note in the REPLACE documentation:
"Here's something to consider if using variables in your MAP. When your proc is loaded, the map is initialized with its data. If the MAP includes any variables, the MAP is initialized with the contents of the variable at that time. This means that if your variable is declared as LOCAL or if you plan to change the value of the variable as the program runs, the MAP will not be initialized as you expect. To let Comet know you want it to use whatever the current value of the variable is at runtime you must use special syntax which includes {}. This is called de-referencing". The link below will show you an example.
When I changed your MAP statement like this, it worked:
MAP: MAP 'S',{B$}
Note the dereferencing seems only to work on the "value" parameter, not the "name" parameter. Thus your program could replace all the "S" with a variety of values depending on the current value of B$.
Now you are only having this issue because you are trying to pre-set the contents of the MAP by specifying the name/value pairs in the MAP statement itself. Instead you could load the MAP at runtime by using the stlSET statement:
LENGTH dynamic & local String$, String64$
LENGTH 1 & LOCAL A$,B$
LENGTH 25 & LOCAL C$,D$
MAP: MAP
CLEAR
A$='S'
B$='Z'
stlset(MAP,a$,b$)
C$='THIS IS A TEST'
D$=REPLACE(MAP,C$)
PRINT D$
WAIT
STOP
It does look like you found a bug, however. Comet shouldn't lock up the CPU like that!
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.