Working with STRSQL command in AS/400

30 pts.
Tags:
Physical Files
STRSQL
How to select a particular member from Physical file through STRSQL.

Can anyone give me the sample sql statement to access a particular member from Physical file ?

Thanks in advance.

 

 

ASKED: December 3, 2009  5:56 AM
UPDATED: October 3, 2011  10:28 PM

Answer Wiki

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

You have to set up an alias for the member first. This gives that specific member a unique name that SQL can relate to.

<pre>
Create alias mylib/myalias for mylib/mypf (mbr)
Select * from mylib/myalias
</pre>

==================================================

Since CREATE ALIAS is a SQL statement, you might not have the authority. Or you might want or need to avoid creating permanent SQL objects in the database catalog. For me, usually it’s just easier to issue an OVRDBF MBR() command to point to the desired member before running a SQL SELECT.

It requires no SQL statement authorization. It doesn’t create a SQL object that needs to be deleted elsewhere. It has no effect on any other job. And it goes away by itself if I sign off. Further, I can issue different overrides at different times to see different members.

An ALIAS is much more appropriate, though, when you want to make a member explicitly available to everyone for an extended time.

Tom

Discuss This Question: 6  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
  • Halp
    Another idea... At the SQL statement command prompt just press F4. It will prompt you through the basic functions and automatiaclly build the correct syntax for you. Used it many times. works like a charm... Hal
    115 pointsBadges:
    report
  • Ankita
    Hi, Is there a way we can use to insert data to a specific member of a file, other than UPDDTA?
    135 pointsBadges:
    report
  • Splat
    Hi, Is there a way we can use to insert data to a specific member of a file, other than UPDDTA? Via SQL (see the above discussion). Via a program (RPG, COBOL, &c.). Via a command (CPYF). That's all that I can think of right off.
    6,255 pointsBadges:
    report
  • philpl1jb
    UPDDTA press F4 fields are: Data base file . . . . . Library . . . . . . . Member . . . . . . . . . Phil
    48,575 pointsBadges:
    report
  • philpl1jb
    Ohhh .. except upddta What's wrong with Tom's answer. SQL-ALIAS? SQL Insert? Maybe you should describe your issues. Phil
    48,575 pointsBadges:
    report
  • TomLiotta
    Is there a way we can use to insert data to a specific member of a file, other than UPDDTA? If this isn't about SQL accessing members, you should open a new question. In that question, you should give a lot more details because there are way too many ways to answer this. 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