![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
#12
| |||
| |||
|
|
Hi I have to disagree re speed. Matrix handling of arrays is orders of magnitude faster than dynamic arrays. Particularly in the case in point where large amounts of data are to be handled. Consider the work involved; for those who remember Cobol moves, the first chunk has to be moved to a new position large enough to hold the altered record , the change has to be concatenated, then the remaining chunk has to be concatenated. The further down an item one goes the more time it takes to find the limit of the first chunk. Therefore changing more than one element is always going to be slower for a dynamic array. The time lost on the read is made up everywhere else. Also one should never keep redimensioning an array as it will crucify the system. The worst example of this is where some junior got at the Dos to Pick transfer program and wrecked it back in the 1980's. A further benefit of matrices is that an element less than 10 bytes long will be altered in situ and an element longer will be identified by an exact address from the initial 10 byte position without having to count through the entire record. |
|
However there is a far greater reason to use matrices when handling normal data. This is the use of the equate. I hate to think of how often I have seen systems messed up by people using offsets in dynamic arrays because they were quite certain that it was field 17 or whatever that needed altering. The best way to access is always to name the field and alter the named item. Then at least the next programmer will know what you meant to alter. I have never been lucky enough to fall across a site apart from my own that kept file definition documentation up to date. I forced the issue by using a generator that goes to the documentation to produce the program. |
#13
| |||
| |||
|
|
"Peter McMurray" <excalibur21 (AT) bigpond (DOT) com> wrote in message news:jhV3f.17893$U51.7552 (AT) news-server (DOT) bigpond.net.au... |
#14
| |||
| |||
|
|
I promise I won't come back here to CDP and say 'but I told Raining Data about this!' =) Well, the thing I'm trying to do is read reports of varying size directly into a dimensioned array without any necessary steps. In otherwords, I was hoping the database could do the dirty work of sizing up that array for me. I would also like figure out how to do this in a manner that will work on other flavors of PICK, not just D3's implementation. But if any implementaion (not just D3) offers a specific optimization for this sort of job I'm all for using those too in the name of performance tuning. The AP manual lead me to believe I could matread a record without having to size the dim'd array but for now the only solution I've come up with is to read it into a dynamic array, dcount the @am's and size the dimensioned array off of that. |
#15
| |||
| |||
|
|
Tedd: Maybe I missed something here but this is the D3 documentation: A "dim" statement without the number of elements specified, such as in the case: "dim a()", may only be used in a subroutine. FlashBASIC run-time determines the number of elements after a "matread". |
#16
| |||
| |||
|
|
Aye, I read that part too. Bill H wrote: Tedd: Maybe I missed something here but this is the D3 documentation: A "dim" statement without the number of elements specified, such as in the case: "dim a()", may only be used in a subroutine. FlashBASIC run-time determines the number of elements after a "matread". This seems to be the point that the book says I can do that I cannot get to work. The only way I've seen it work is when a dimensioned array is sized in the calling program passed in tne subroutine arguments (or the commons?). I'd love to see an example of a matread actually sizing the dimensioned array it uses to read the record into. The D3 "book" certainly alludes to that being a possiblity. What about other PICK flavors? |
![]() |
| Thread Tools | |
| Display Modes | |
| |