|
> A user index is limited to only 2000 bytes per entry Pretty big record, 2000 bytes. > can have only one key But like any key, can be a composite. > It really depends on what your application does I agree with you. Depends on what the application requires. My only statement was that if you start needed to get arrays that huge, might be time to look at a user index. We have an application that uses mobs and mobs of arrays. Each exceeding 32767 elements so they have to have Ar1A, Ar1B, Ar1C, etc. Talk about a mess. If the person who had written it had used User Indexes, it would have been a thousand times easier. If you were sorting a subfile full of data on different fields, arrays and QSORT probably makes more sense. Subfile is usually fairly small. What sense do it make to load a subfile with 2000 pages of data? How many users are really going to look at that much data? You could, also, get a pointer to a user space, load data into the user space and use the QSORT to put it into correct sequence. Limitation of 32MB on User Space but assuming a record with 50 bytes that would be around 22 million records. Now there's a subfile! I like working with User Spaces. A nice combination of memory and disk. Basically a memory mapped file and since QSORT doesn't care where the fields to sort on are( You implement the compare), multiple keys can be used. -----Original Message----- From: Scott Klement [mailto:rpg400-l@xxxxxxxxxxxxxxxx] Sent: Tuesday, March 29, 2005 3:36 PM To: RPG programming on the AS400 / iSeries Subject: RE: Arrays Hi Alan, > > If you are getting that big, I would be looking at a User Index. That's > what they are designed for. > Maybe. Depends on what you mean by "that big." A user index is limited to only 2000 bytes per entry, whereas an array has no such limitation. User indexes must be keyed, and can have only one key. If you want to be able to sort it any number of different ways, they're not practical since you'd have to re-build the index for every possible sequence. Likewise, if you want to read things in arrival sequence all the time, a user index would be much slower than direct memory access. It really depends on what your application does and what your project goals are. A user index is often a great choice -- but there are many circumstances where it's not.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.