SQL on multi-membered file without overriding

Tags:
AS/400
SQL
How to query on a file and retrieve data from any of the members of the file without overriding to any of them?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Sounds like a homework question. Why can’t an override be used?? philpl1jb’s answer is probably the easiest. There are other solutions like creating a LF for each member you want and query those new LF’s.  

It’s not an “override” in the sense that you are using an OVRDBF command but another view of the database. There are most likely other methods but we would need to know more about the project in question.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • philpl1jb

    SQL alias might do what you want

    >>-CREATE---ALIAS-------alias-name------------------------------>

    >-----FOR--+-table-name-+---+--------------------+-------------><
               '-view-name--'   '-(--member-name--)--'
     

    Then you query the Alias instead of the table

    So if you had a member named January in the table Sales:

    CREATE ALIAS SALES_JANUARY
      FOR SALES(JANUARY)

    Select * from Sales_January;

    54,090 pointsBadges:
    report
  • philpl1jb

    Actually you would probably want to specify the library that the Alias is created in and if it's QTEMP then it will only exist for this job.

    CREATE ALIAS QTEMP/SALES_JANUARY
      FOR SALES(JANUARY)

    54,090 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: