Hi Alan,
You cannot create a view for built over a file member neither a view over an
alias that points to a file member.
But it is possible to access members from within an UDTF and UDTFs can be
specified within the FROM clause of an SELECT statement and used like any
table or view:
Example:
Assumed an alias that points to a member already exist, you can create the
following UDTF.
CREATE FUNCTION YourSchema/YourUDTF()
RETURNS TABLE( Col1 Char(10), Col2 Dec(11, 2), .... ColN DataType(Length) )
LANGUAGE SQL
MODIFIES SQL DATA
Return Select Col1, Col2, ... ColN from YourAlias;
After the UDTF is generated it can be accessed as follows:
Select *
From TABLE(YourUDTF()) x;
If the alias does not exist, the creation can be included in the UDTF source
code.
For more information about UDTFs (you may refer to the following article:
The power of user-defined table functions
http://www.ibm.com/developerworks/ibmi/library/i-power-of-udtf/
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Alan Shore
Gesendet: Thursday, 08.8 2013 20:09
An: midrange-l@xxxxxxxxxxxx
Betreff: SQL views over multi member physical file
Hi everyone
Before I forget - we are on V5r4
We have a multi-member file (presently 16 members - but can increase) There
is a need is to create individual SQL views over each of these members I
understand/know about alias's, but from what I have
googled/yahoo'ed/searched, it looks like I cannot create a view over an
alias Question 1 - is this in fact true?
Question 2 - In creating the alias (or view for that matter), is there a way
to limit the alias (or view for that matter) to the LAST n records?
As always - any and all responses gratefully accepted
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
Disclaimer: This message contains confidential information and is intended
only for the individual named. If you are not the named addressee you should
not disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system. E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender
therefore does not accept liability for any errors or omissions in the
contents of this message, which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. Any views or
opinions presented are solely those of the author and do not necessarily
represent those of the company.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.