Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2017-04-21 09:44:34 Link
VF9SP2
Currently, I'm simply doing this for now:
RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename))
Is there a better (read: FASTER) way? These are tab delimited text
files so I can't really use FSEEK or FSIZE(m.Filename) (which requires
SET COMPATIBLE ON) because I can't be sure of each record's length.
tia,
--Mike
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/6a24d7f05f6f8a9d3dbc3f902e03dc3e@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Richard Kaye
Posted: 2017-04-21 09:47:35 Link
ALINES()?
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com
Sent: Friday, April 21, 2017 10:45 AM
To: profoxtech@leafe.com
Subject: Getting count of rows in a text file -- best approach?
VF9SP2
Currently, I'm simply doing this for now:
RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename))
Is there a better (read: FASTER) way? These are tab delimited text
files so I can't really use FSEEK or FSIZE(m.Filename) (which requires
SET COMPATIBLE ON) because I can't be sure of each record's length.
tia,
--Mike
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/BN4PR10MB0913286D8C30227781ACB000D21A0@BN4PR10MB0913.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Gianni Turri
Posted: 2017-04-21 10:02:23 Link
On Fri, 21 Apr 2017 10:44:34 -0400, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
>VF9SP2
>
>Currently, I'm simply doing this for now:
>
>RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename))
>
>Is there a better (read: FASTER) way? These are tab delimited text
>files so I can't really use FSEEK or FSIZE(m.Filename) (which requires
>SET COMPATIBLE ON) because I can't be sure of each record's length.
Hi Mike,
I have never used fsize this way, I always use fseek to calculate files size.
m.handle = fopen(m.Filename, 0)
m.size = fseek(m.handle, 0, 2)
fclose(m.handle)
To answer your question, try this:
create cursor TMP_CURSOR (DUMMY Character (1))
append from (m.Filename) sdf
m.RowCount = reccount() +1
USE in TMP_CURSOR
? m.RowCount
--
Gianni
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/l27kfc58h4400rk01811jbgnifgtegbr4q@4ax.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2017-04-21 10:20:05 Link
On 2017-04-21 10:47, Richard Kaye wrote:
> ALINES()?
Is that your answer for everything today? lol
Nah, that feels no less dirty than my approach. My bet is that would
require as many (if not more) processing cycles, but of course only
testing would show conclusively if at all.
Thanks though!
--Mike
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/4ac11a07810e5b7cd76b297034d26e5e@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Richard Kaye
Posted: 2017-04-21 10:24:08 Link
Only when it fits the situation. :-)
Dirty? Really? One line of code returns the number of rows in your string. Which was your original question.
Benchmark it and you'll find out which one is faster and whether or not you can live with that slightly soiled sensations... ;-)
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com
Sent: Friday, April 21, 2017 11:20 AM
To: profoxtech@leafe.com
Subject: RE: Getting count of rows in a text file -- best approach?
On 2017-04-21 10:47, Richard Kaye wrote:
> ALINES()?
Is that your answer for everything today? lol
Nah, that feels no less dirty than my approach. My bet is that would
require as many (if not more) processing cycles, but of course only
testing would show conclusively if at all.
Thanks though!
--Mike
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/BN4PR10MB09136D18738401672D131BB3D21A0@BN4PR10MB0913.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Gianni Turri
Posted: 2017-04-21 10:27:37 Link
On Fri, 21 Apr 2017 17:02:23 +0200, Gianni Turri <giannit62@gmail.com> wrote:
>On Fri, 21 Apr 2017 10:44:34 -0400, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
>
>>VF9SP2
>>
>>Currently, I'm simply doing this for now:
>>
>>RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename))
>>
>>Is there a better (read: FASTER) way? These are tab delimited text
>>files so I can't really use FSEEK or FSIZE(m.Filename) (which requires
>>SET COMPATIBLE ON) because I can't be sure of each record's length.
>
>Hi Mike,
>
>I have never used fsize this way, I always use fseek to calculate files size.
>
>m.handle = fopen(m.Filename, 0)
>m.size = fseek(m.handle, 0, 2)
>fclose(m.handle)
>
>To answer your question, try this:
>
>create cursor TMP_CURSOR (DUMMY Character (1))
>
>append from (m.Filename) sdf
>
>m.RowCount = reccount() +1
>
>USE in TMP_CURSOR
>
>? m.RowCount
May be you must use only reccount() instead of reccount() +1.
--
Gianni
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/m69kfcd71gcd81jhctf2nbe3aj1fa5792a@4ax.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2017-04-21 13:34:18 Link
On 2017-04-21 11:27, Gianni Turri wrote:
> On Fri, 21 Apr 2017 17:02:23 +0200, Gianni Turri <giannit62@gmail.com>
> wrote:
>
>> On Fri, 21 Apr 2017 10:44:34 -0400,
>> mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
>>
>>> VF9SP2
>>>
>>> Currently, I'm simply doing this for now:
>>>
>>> RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename))
>>>
>>> Is there a better (read: FASTER) way? These are tab delimited text
>>> files so I can't really use FSEEK or FSIZE(m.Filename) (which
>>> requires
>>> SET COMPATIBLE ON) because I can't be sure of each record's length.
>>
>> Hi Mike,
>>
>> I have never used fsize this way, I always use fseek to calculate
>> files size.
>>
>> m.handle = fopen(m.Filename, 0)
>> m.size = fseek(m.handle, 0, 2)
>> fclose(m.handle)
>>
>> To answer your question, try this:
>>
>> create cursor TMP_CURSOR (DUMMY Character (1))
>>
>> append from (m.Filename) sdf
>>
>> m.RowCount = reccount() +1
>>
>> USE in TMP_CURSOR
>>
>> ? m.RowCount
>
> May be you must use only reccount() instead of reccount() +1.
Ok now I get your approach. Cool trick. I tried it. In testing, it
actually wasn't any faster than the OCCURS approach. But thanks for the
response though!
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/b8d916da69790690cb0db19e4033d9ad@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Richard Kaye
Posted: 2017-04-21 13:56:40 Link
Did you benchmark with ALINES? :-)
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com
Sent: Friday, April 21, 2017 2:34 PM
To: profoxtech@leafe.com
Subject: Re: Getting count of rows in a text file -- best approach?
Ok now I get your approach. Cool trick. I tried it. In testing, it
actually wasn't any faster than the OCCURS approach. But thanks for the
response though!
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/BN4PR10MB0913559A8D4CD6F87E4E8C30D21A0@BN4PR10MB0913.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2017-04-21 15:37:37 Link
On 2017-04-21 11:24, Richard Kaye wrote:
> Only when it fits the situation. :-)
>
> Dirty? Really? One line of code returns the number of rows in your
> string. Which was your original question.
My solution was 1 line too: RowCount =
OCCURS(CHR(13),FILETOSTR(m.Filename)) <g>
>
> Benchmark it and you'll find out which one is faster and whether or
> not you can live with that slightly soiled sensations... ;-)
Testing showed these two pretty much a dead heat:
RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename))
RowCount = ALINES(aCrap,FILETOSTR(m.Filename))
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/600a4ec877828599934fffecd9660ad9@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Richard Kaye
Posted: 2017-04-21 15:41:26 Link
Thanks. I was curious. :-)
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com
Sent: Friday, April 21, 2017 4:38 PM
To: profoxtech@leafe.com
Subject: RE: Getting count of rows in a text file -- best approach?
On 2017-04-21 11:24, Richard Kaye wrote:
> Only when it fits the situation. :-)
>
> Dirty? Really? One line of code returns the number of rows in your
> string. Which was your original question.
My solution was 1 line too: RowCount =
OCCURS(CHR(13),FILETOSTR(m.Filename)) <g>
>
> Benchmark it and you'll find out which one is faster and whether or
> not you can live with that slightly soiled sensations... ;-)
Testing showed these two pretty much a dead heat:
RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename))
RowCount = ALINES(aCrap,FILETOSTR(m.Filename))
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/BN4PR10MB0913B5643363471841EB34ACD21A0@BN4PR10MB0913.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.