![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
The "approximate" count comes from the file-of-files... it is approximate only because, in a dynamic environment, items may be in the process of being written to, or deleted from, the file in question while you are counting it. (Also, since it is based on the fof, you have to have run a recent file-save with the (s option, or counted or selected the file before the fof count is updated. There is an estimate-count verb that gives you this total instantly. I usually create a synonym called ecount because it's easier to type. ecount (or estimate-count) uses a user exit, so I also have a subroutine to do the same thing: 01 sub ecount.sub(filename,count) 02 * returns estimate-count of number of items in filename 03 * 03-13-00 asb 04 05 count = 0 06 open filename to fv else return 07 read x from fv,"" else null 08 count = oconv("","u0065") ;* returns -1 if estimate not available 09 10 if count gt 0 then 11 print count:" items in ":filename:"." 12 end 13 14 return /Scott Ballinger Pareto Corporation Edmonds WA USA 206 713 6006 |
#4
| |||
| |||
|
|
Thanks Scott .. So this is just based on the last file-save .. humm |
#5
| |||
| |||
|
|
Thanks Scott .. So this is just based on the last file-save .. humm Don't mean to imply that, and I don't think so. I am guessing that here has to be a fof entry for the file, thus if no file-save, no fof entry. However, I think the select and count verbs will create an entry in fof (and populate it with the current count) if it's not already there. Look at the source for estimate-count... if the user- exit returns -1 then then it executes a regular "count" and from then on it (the estimage-count verb) knows the current count (which is also updated when items are created or deleted via the editor, delete, copy, basic, whatever; like the btree indexes are updated no matter how a file is changed). Maybe I am wrong about the fof... and the current count is just kept in the fcb somewhere? Anyway, estimate-count is not dependent on the filesave, or the last count or select (those are just required to initialize it). It is updated in real time and in my experience highly reliable. /Scott |
#6
| |||
| |||
|
|
On Mar 6, 11:55 am, "Scott Ballinger" <scott.ballin... (AT) gmail (DOT) com wrote: Thanks Scott .. So this is just based on the last file-save .. humm Don't mean to imply that, and I don't think so. I am guessing that here has to be a fof entry for the file, thus if no file-save, no fof entry. However, I think the select and count verbs will create an entry in fof (and populate it with the current count) if it's not already there. Look at the source for estimate-count... if the user- exit returns -1 then then it executes a regular "count" and from then on it (the estimage-count verb) knows the current count (which is also updated when items are created or deleted via the editor, delete, copy, basic, whatever; like the btree indexes are updated no matter how a file is changed). Maybe I am wrong about the fof... and the current count is just kept in the fcb somewhere? Anyway, estimate-count is not dependent on the filesave, or the last count or select (those are just required to initialize it). It is updated in real time and in my experience highly reliable. /Scott thanks for the follow-up. sorry for the misunderstanding. will give it a try- Hide quoted text - - Show quoted text - |
#7
| |||
| |||
|
|
On Mar 6, 1:48 pm, "dtsig" <d... (AT) hotmail (DOT) com> wrote: On Mar 6, 11:55 am, "Scott Ballinger" <scott.ballin... (AT) gmail (DOT) com wrote: Thanks Scott .. So this is just based on the last file-save .. humm Don't mean to imply that, and I don't think so. I am guessing that here has to be a fof entry for the file, thus if no file-save, no fof entry. However, I think the select and count verbs will create an entry in fof (and populate it with the current count) if it's not already there. Look at the source for estimate-count... if the user- exit returns -1 then then it executes a regular "count" and from then on it (the estimage-count verb) knows the current count (which is also updated when items are created or deleted via the editor, delete, copy, basic, whatever; like the btree indexes are updated no matter how a file is changed). Maybe I am wrong about the fof... and the current count is just kept in the fcb somewhere? Anyway, estimate-count is not dependent on the filesave, or the last count or select (those are just required to initialize it). It is updated in real time and in my experience highly reliable. /Scott thanks for the follow-up. sorry for the misunderstanding. will give it a try- Hide quoted text - - Show quoted text - The count is stored in the FCB and updated real time and fairly reliable: The reason it's accuracy must be qualified as only being "approximate" -- is that the update is not done under lock and can on rare (?) exception miss updates (causing the count to be over/under.)- Hide quoted text - - Show quoted text - |
#8
| |||
| |||
|
|
On Mar 8, 2:21 am, "dzigray" <goo... (AT) bridge2 (DOT) com> wrote: On Mar 6, 1:48 pm, "dtsig" <d... (AT) hotmail (DOT) com> wrote: On Mar 6, 11:55 am, "Scott Ballinger" <scott.ballin... (AT) gmail (DOT) com wrote: Thanks Scott .. So this is just based on the last file-save .. humm Don't mean to imply that, and I don't think so. I am guessing that here has to be a fof entry for the file, thus if no file-save, no fof entry. However, I think the select and count verbs will create an entry in fof (and populate it with the current count) if it's not already there. Look at the source for estimate-count... if the user- exit returns -1 then then it executes a regular "count" and from then on it (the estimage-count verb) knows the current count (which is also updated when items are created or deleted via the editor, delete, copy, basic, whatever; like the btree indexes are updated no matter how a file is changed). Maybe I am wrong about the fof... and the current count is just kept in the fcb somewhere? Anyway, estimate-count is not dependent on the filesave, or the last count or select (those are just required to initialize it). It is updated in real time and in my experience highly reliable. /Scott thanks for the follow-up. sorry for the misunderstanding. will give it a try- Hide quoted text - - Show quoted text - The count is stored in the FCB and updated real time and fairly reliable: The reason it's accuracy must be qualified as only being "approximate" -- is that the update is not done under lock and can on rare (?) exception miss updates (causing the count to be over/under.)- Hide quoted text - - Show quoted text - Really?! You mean there is core code that increments a count without taking a lock? And we're talking about the FCB? Wouldn't updates to the FCB have to be ACID? Also, I don't have a D3 system available atm but I was pretty sure the count was in the FOF. Have I therefore made an incorrect assumption that this is where the estimate-count comes from when it really comes from the FCB? |
#9
| |||
| |||
|
|
On Mar 8, 2:21 am, "dzigray" <goo... (AT) bridge2 (DOT) com> wrote: On Mar 6, 1:48 pm, "dtsig" <d... (AT) hotmail (DOT) com> wrote: On Mar 6, 11:55 am, "Scott Ballinger" <scott.ballin... (AT) gmail (DOT) com wrote: Thanks Scott .. So this is just based on the last file-save .. humm Don't mean to imply that, and I don't think so. I am guessing that here has to be a fof entry for the file, thus if no file-save, no fof entry. However, I think the select and count verbs will create an entry in fof (and populate it with the current count) if it's not already there. Look at the source for estimate-count... if the user- exit returns -1 then then it executes a regular "count" and from then on it (the estimage-count verb) knows the current count (which is also updated when items are created or deleted via the editor, delete, copy, basic, whatever; like the btree indexes are updated no matter how a file is changed). Maybe I am wrong about the fof... and the current count is just kept in the fcb somewhere? Anyway, estimate-count is not dependent on the filesave, or the last count or select (those are just required to initialize it). It is updated in real time and in my experience highly reliable. /Scott thanks for the follow-up. sorry for the misunderstanding. will give it a try- Hide quoted text - - Show quoted text - The count is stored in the FCB and updated real time and fairly reliable: The reason it's accuracy must be qualified as only being "approximate" -- is that the update is not done under lock and can on rare (?) exception miss updates (causing the count to be over/under.)- Hide quoted text - - Show quoted text - Really?! You mean there is core code that increments a count without taking a lock? And we're talking about the FCB? Wouldn't updates to the FCB have to be ACID? Also, I don't have a D3 system available atm but I was pretty sure the count was in the FOF. Have I therefore made an incorrect assumption that this is where the estimate-count comes from when it really comes from the FCB?- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |