Multi-member file in AS/400 (SQL query)

345065 pts.
Tags:
AS/400
SQL Query
On my AS/400 in an interactive SQL (5250 session),
select * from myfile
only returns rows from one member when  "myfile" has more than one member.

But how can I get rows from a specific member? Thanks for the help!

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb

    Use:  SQL command Create alias to create a path to the member

    Then:  do queries on the alias.

    CREATE ALIAS MYLIB/MYALIAS FOR MYLIB/MYFILE (MYMEMBER)

    Select * from MyAlias

    49,840 pointsBadges:
    report
  • TomLiotta

    Generally, you shouldn't use multi-member files for SQL. SQL has no concept of "members". DB2 on AS/400s allows you to use CREATE ALIAS as Phil describes in order to point a query to a particular member. You can also use OVRDBF before running a query in order to override the file to a chosen member.

    An ALIAS creates a permanent database object. It becomes available to all authorized jobs on the system until a DROP ALIAS statement deletes. The creation of an ALIAS involves the system doing all of the usual work of object creation, setting ownership and authorities, etc. An override applies only to the job or activation that it runs within, and it's active until the job (or activation group) ends or a DLTOVR is run.

    Better would be to eliminate the members and replace them with a reasonable SQL table. The sets of rows in each member would be indicated by a column that limited which rows went in each group.

    Tom


    125,585 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following