* DBLTEST.PRG eliminate large numbers of multiple spaces with the least
* number of replace clauses and no _tally loop
clos data
set talk off
erase ("temp.dbf")
#define SPLEN 254
create table temp (spaces c(SPLEN))
for m.i=1 to SPLEN-2
append blank
repl spaces with "A"+space(m.i)+"B"
endfor...
Not only are there old programs that still run fine, there are old problems that newer software make so much more difficult that they wouldn't be worth doing any more.
SELECT-SQL does not select records with a scope nor does it use relations the way you do so the SET DELETED command is not expected to work with SELECT-SQL. I tried to defeat SET DELETED the way that Fox would with this code:
USE FILE && Some deleted records here
SET DELETED ON && no longer...
The correct solution is to stop using DELETED() and make your own field that does the same thing which will always work with SELECT. SELECT does not handle DELETED() or RECNO() properly, particularly when GROUP BY is present. Try this code on any table to see what I mean:
SELECT RECNO() AS...
It's working here.
clos data
erase ("test.dbf")
create table test (zip c(5))
zips='00000,11296,90000,95800,95814,95900,96001,99999'
do while len(zips)>0
if ","$zips then
zw=left(zips,at(',',zips)-1)
zips=substr(zips,at(',',zips)+1)
else
zw=zips
zips=""
endif
append...
>The production of the file via SORT or COPY TO is not necessary for this task.
It's not necessary. It's usually faster to do what looks like extra work.
>Added 3 junk fields to tblPhone
My original file is 500 character per record * 300,000 records for 150MB in random order. When I extract...
>Sorting to another temporary dbf AND creating an index on the fields you sorted on
If the Fox team were a bit smarter, SORT+INDEX could have been provided as a single operation which would make it faster without exception. Perhaps SQL subselects already do this.
>for sure isn't the fastest...
None of the provided solutions are fast or organized enough. Relations will handle all details at top speed if you use them right.
clos data
erase ("temp.dbf")
use phone
sort on zip,address to temp fields zip,address,phone for not empty(phone)
clos data
use temp alias source
index on...
>I thought that Left Alt+Enter interactively causes the screen switch, but does not set it to one mode or the other on a permanent basis for subsequent application launches.
Windows 9x, permanent.
Windows NT, temporary.
I avoid putting constants into the code like 10 since they are likely to change later. I'd like the code to adapt.
REPLACE ALL charfield WITH Padl(ALLTRIM(STR(numfield)), len(charfield), '0')
This also makes it obvious that 10 isn't some value picked out of thin air.
Is it possible to keep the record count of the two files exactly the same so there is a RECNO() one to one correspondance between files? If so then they are easy to link.
clos data
use table055
sele 0
use table250
set rela to recno() into table055
With this code, each time you move RECNO() in...
The above code may work but wouldn't be appropriate if the files are very large. Here is the same thing in high performance code that makes full use of the Fox relational database:
set talk on
CLOS DATA
USE MASTER
INDEX ON PHONE UNIQUE COMPACT TO TEMP
SELE 0
USE MAIL
SET RELA TO PHONE INTO...
Using ERASE CLT.CDX will generate an error when CLT.DBF is opened the next time. I find that DELETE TAG ALL accomplishes the same thing without any errors.
Same here with FPD 2.5 and Windows XP SP2. Something I noticed during testing is that Windows does some fancy tricks with the clock for DOS programs. It will only change the time in a DOS window when a program is launched or quit. Norton Commander and FOX both display a clock. If I change the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.