Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Small .prg slows network
Message
De
14/11/1997 16:25:32
 
 
À
14/11/1997 16:21:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00060184
Message ID:
00060360
Vues:
40
>>>>>>>>>I run a .prg to count the occurances of certain field contents on a file with 800000 records.
>>>>>>>>>
>>>>>>>>>another user (next to me) tries to bring up printer properties and gets the hour glass but no properties.
>>>>>>>>>
>>>>>>>>>I escape out of the .prg and his printer properties appear...
>>>>>>>>>
>>>>>>>>>What could cause this?
>>>>>>>>Larry,
>>>>>>>>
>>>>>>>>If your prg is pounding at the server without allowing for anyone else to get a word in edgerwise then that would explain what you see. Why not post the small PRG and see anyone can give you any advice about how to get it to better behave in a network environment.
>>>>>>>
>>>>>>>That's a great idea...
>>>>>>>
>>>>>>>Here it is:
>>>>>>>
>>>>>>>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
>>>>>>>***********************************************************
>>>>>>
>>>>>>Larry- I think what you are trying to do can be accomplished with one statement:
>>>>>>
>>>>>>SELECT count(*), distinct *;
>>>>>>FROM masterfile;
>>>>>>INTO CURSOR countfile;
>>>>>>WHERE inactive <> "Y";
>>>>>>GROUP BY agegrp, district
>>>>>>
>>>>>>This doesn't directly apply to your question, but could possibly reduce the time it takes to create your countfile table.
>>>>>>HTH
>>>>>
>>>>>Thank you all for your input. I always wanted to use a SELECT statement to accomplish this but did not know that the 'GROUP BY' clause worked in conjunction with the 'DISTINCT' clause.
>>>>>
>>>>>This is great! I'll try it immediately. What if I want to agegrp's into Under_50 and Over_50 and count by category (assume that agegrp contains the actual age in years)????
>>>>
>>>>Well, as Edward pointed out, I don't think that you really need the distinct. (Sorry) I'm not sure I understand your second question... could you restate?
>>>
>>>Yes, I left out a few words...
>>>
>>>What if I want to group agegrp's into categories (Under_50 and Over_50) and get totals by category (assume that agegrp contains the actual age in years)????
>>
>>Select district, iif(agegrp>50,"more","less"), count(*) as totnumber ;
>>From ...
>>Group by 1,2
>
>Thank you Ed... what took you so long ;)

It's Friday.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform