David is correct (re: performance). Most of our app here have MV lists under 
40-50 so it's not a huge issue. If you app has hundreds+ this could be a big 
challenge.

Jeff Butera
--
A tree falls the way it leans.
Be careful which way you lean.
The Lorax

On Feb 11, 2013, at 8:30 AM, Dave Laansma <dlaan...@hubbardsupply.com> wrote:

> I would HOPE that it evaluates it each time since the size of <array> could 
> change within the loop.
> 
> Personally if the size of <array> is relatively small, DCOUNT is alright. 
> However I've found REMOVE to be EXTREMELY faster and therefore use it 
> whenever possible, even on small <arrays>.
> 
> For example, we have two files, a 'header' and 'detail' file. The keys to the 
> 'detail' file are stored in attribute <200> of the header file. So I'll pull 
> the keys out of the header record, such:
> 
> LINE.KEYS = HEADER.REC<200>
> D1 = ""
> LOOP UNTIL D1 = 0
>  REMOVE LINE.KEY FROM LINE.KEYS SETTING D1
>  <loop statements>
> REPEAT
> 
> As opposed to:
> 
> FOR V1 = 1 TO DCOUNT(HEADER.REC<200>,@VM)
>  LINE.KEY = HEADER.REC<200,V1>
>  <loop statements>
> NEXT V1
> 
> Based on historical dialogs on this subject on this forum, I have seen an 
> improvement in overall performance.
> 
> Sincerely,
> David Laansma
> Hubbard Supply Co.
> Direct: 810-342-7143
> Office: 810-234-8681
> Fax: 810-234-6142
> www.hubbardsupply.com
> "Delivering Products, Services and Innovative Solutions"
> 
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org 
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jeffrey Butera
> Sent: Monday, February 11, 2013 7:55 AM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] : Evaluating DCOUNT
> 
> On 02/11/2013 12:14 AM, Peter Cheney wrote:
>> Hi Everyone,
>> 
>> Does a DCOUNT get evaluated again for each iteration of a loop?
>> Or is UniVerse these days intelligent enough to keep track of what's going 
>> on?
>> 
>> e.g.
>> 
>> for i = 1 to dcount(array,@fm)
>>    *commands here
>> next i
>> 
>> versus
>> 
>> totalattributes = dcount(array,@fm)
>> for i = 1 to totalattributes
>>    *commands here
>> next i
>> 
>> Apart from readability and perhaps easier debugging is there an actual 
>> internal difference?
>> I know it was an issue on older pick releases but I cannot remember if it 
>> ever affected UV?
> 
> Not sure about universe, but unidata defintely checks the DCOUNT for each 
> iteration.  This produces 4 (not 2):
> 
> 
> CT=0
> X=45:@VM:58
> FOR I=1 TO DCOUNT(X,@VM)
>   CT+=1
>   IF I<=2 THEN
>     X<1,-1> = 99
>   END
> NEXT I
> CRT CT
> 
> 
> -- 
> Jeffrey Butera, PhD
> Associate Director for Application and Web Services
> Information Technology
> Hampshire College
> 413-559-5556
> 
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to