From: Walden H. Leverich

What about when you're selecting on one set of fields and ordering on
another. Let's say you wanted to display two views of order-details, one
by line-number and on by item-number. In both cases we're talking about
lines for a single order, and our average order has 10 lines.

I'm not going to argue this particular point, but I've always found that
design decisions made because "our average frommitz has seven glimples" have
a tendency to bite you in the butt.

But sometimes you do have to make those sorts of decisions, so let's
continue on.


In ISAM world you would need an index by Order, OrderLineNumber and
another by Order, OrderLineItem, where in SQL you would just need the
index by Order and then let it sort. You're sorting few enough rows that
the sort makes sense. Not to mention, how do you do a view sorted by
item-description? An array?

Well, if I was really handling this as a sortable array of records of
limited size, I'd probably do just that: an array of data structures. Easy
to do in RPG, and you can sort by any of the subfields pretty easily
(although in complex situations you might have to use QSORT), and by using
the %subarr BIF, it's quite easy to create a huge array, base it so that it
doesn't take memory, then allocate and deallocate it as needed.


Point is, in ISAM-land you _must_ have an index, in SQL-land you
_probably should_ have an index, but sometimes you don't need one.

And that is the beauty of i5/OS and RPG! If you really do need a truly ad
hoc access, you can use OPNQRYF or embedded SQL. If you go with a pure SQL
environment with no ISAM access, you don't have the option.

joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.