Unable to use delete statement How can I delete multiple duplicates in a PF leaving only one in SQLRPG

5 pts.
Tags:
AS/400 SQL
RPG
RPGLE
Background... I use OCL and SQLRPG. I am having an issue after I have built a file of records from my Select. This file contains duplicates that I need to remove. I have a EXEC SQL DELETE clause in the RPG after my "DO" loop ends. The command does nothing, however, when I drop the command into a 400 sQL session, she runs great. Please advise...

Here is the snippet

 /free                                                                                    endif;                                                                              enddo;                                                                                                                                                                      exec sql close ahpl1c1;                                                                exec sql Delete from ahpl F1 where RRN(f1) > (select MIN(RRN(F2))                     from ahpl F2 where F2.f00001 = F1.f00001);                                                                                                                                                                                                                       *inlr = *on;                                                                                                                                                               /end-free                                                                           

Answer Wiki

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

I just had a similar issue. When I compiled the SQLRPG with the option COMMIT *NONE my update worked. The same idea may apply here.

Mike L.

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
    I use OCL and SQLRPG.... Yet the snippet you showed is SQLRPGLE. Are you sure you're committing your transactions properly? 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