Can I use SQL to delete a couple record from a member of a physical file?

5 pts.
Tags:
AS400 DFU
AS400 iseries
SQL
I have a physical file that have multiple member and I delete a couple records from one of the member.  I'm not sure if I can use SQL to do it.  I'm using DFU to remove records now.

Thanks!!



Software/Hardware used:
iSeries

Answer Wiki

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

Yes, you can
1. Use SQL to create an ALIAS file
CREATE ALIAS QTEMP/&yourFile FOR &yourLib/&yourFile (&yourMember)

2. Use your SQL statement ot update the file QTEMP/&yourFile

3. Delete QTEMP/&yourFile

NOTE: you do not need to use QTEMP. I just do the so I do not leave unneeded objects on the system since for me these are one time shots.
If you are doing many SQL statements over the same members, you may want to leave themn on the system.

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Absolutely right but confusing, Charllie used &yourFile for both the file name and the Alias name.

1. Use SQL to create an ALIAS file
CREATE ALIAS QTEMP/yourAlias FOR yourLib/yourFile (yourMember)

2. Use SQL to
Delete QTEMP/yourALIAS where …… rules for finding records to be deleted.

3. If you want to delete alias Use SQL
Drop Alias QTEMP/yourAlias

———-
By creating the Alais in QTEMP it goes away when your job ends. If you want the alias to be persistant then create it in a real library.
Phil
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Discuss This Question: 1  Reply

 
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
  • TomLiotta
    For a basic temporary change, just use OVRDBF to override to the desired member before running your SQL DELETE. 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