the objective is to count number of (active) people
in each district / age_group
***********************************************************
CLOS ALL
CLEA ALL
CLEA
SET EXCL OFF
SET TALK OFF
SET ESCA ON
SET SAFE OFF
SET DELE ON
USE MasterFile
COPY STRU TO CountFile
SELECT 0
USE CountFile EXCL
INDEX ON DISTRICT + AGEGRP TAG DISTRICT
SELECT MasterFile
nCount = 0
SCAN
nCount = nCount + 1
@ 05,02 SAY nCount
*
IF INACTIVE <> 'Y'
cAgeGrp = AGEGRP
cDistrict = DISTRICT
*
* increment total
IF ! SEEK(cDistrict + cAgeGrp,"CountFile","District")
INSERT INTO CountFile (DISTRICT,AGEGRP) VALUES (cDistrict, cAgeGrp)
ENDIF
REPLACE TOTAL WITH TOTAL + 1 IN CountFile
ENDIF
ENDSCAN
***********************************************************
Have you tried to do a SELECT statement instead??? I would fathom a guess that it may be a little faster and less of a server hog than your current code.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only