Is SQL cursor processing in play?
For example:

exec sql declare ALLFILES cursor for
SELECT 'LIB1' AS LIBRARY,A.* FROM LIB1/FILEA A
UNION ALL
SELECT 'LIB2' AS LIBRARY,A.* FROM LIB2/FILEA A
UNION ALL
SELECT 'LIB3' AS LIBRARY,A.* FROM LIB3/FILEA A
ORDER BY USER_NUMBER, LIBRARY;
exec sql open ALLFILES;
exec sql fetch ALLFILES into :recordStructureIncludingLibraryName;
while (sqlca.sqlcode > -1 && sqlca.sqlcode != 100)
{
... process data in recordStructureIncludingLibraryName ...
exec sql fetch ALLFILES into :recordStructureIncludingLibraryName;
}

The ORDER BY will ensure sequencing you desire and cursor processing is very
much like what you're used to with RLA.
BTW, I believe the Union limit may have been 32 on older releases and 256 on
newer releases, but you should be able to verify that in the 'maximum
capacities' IBM whitebook.

Elvis

Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
OS/400
www.centerfieldtechnology.com


-----Original Message-----
Subject: Re: SQL question: something analogous to a multi-format logical . .
.

Combining what Vern offered with what Elvis offered, and testing it on
our V5 box, I found that I could set up a UNION VIEW.

But is there any way to index it, so that when opened through native RLA
(in this case, from C), it's sequenced according to first the "user
number" field, then Vern's library tag field?

In other words, the same effect as if I INSERTed the UNIONed SELECT into
a receiver PF that was keyed on those two fields (which is another
concept under consideration, but would have its costs).

Also under consideration is a non-SQL possibility, the use of a trigger
to slave a composite PF to all of the individual instance enrollment
files. (And God knows I have experience doing insanely complex things in
triggers, including slaving one file to another, and somehow getting
away with it!)

--
JHHL
--




This thread ...

Replies:

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

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