embedded sql update

8775 pts.
Tags:
Embedded SQL
RPGLE
SQL
I have a prog that should update all KY cust master records with the new code AR.

I run the program but nothing happens. The file remains unchanged.

I am new to embedded sql so what am I doing wrong ??

D OLDWH           S              2    INZ('KY')    D NEWWH           S              2    INZ('AR')                                                        * Get all records with 'KY'                       C/EXEC SQL                                         C+                  UPDATE TRNLIB/CMP              C+                     SET CMWH = :NEWWH           C+                     WHERE CMWH = :OLDWH         C/END-EXEC                                                                                            C                   EVAL      *INLR = '1'         

 

Answer Wiki

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

A couple of thoughts.
1. do you need to use COMMIT(NC). It could be changing the data but because of no commit, it does a rollback.
2. If you run the statement with STRSAL does it change any data/

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
  • ToddN2000
    Thanks for the info.. I poked around a lot more and found this example code. Put this in before my previous logic and all is well now. C/EXEC SQL C+ Set Option C+ Commit = *NONE, C+ CloSqlCsr = *ENDMOD C/END-EXEC
    8,775 pointsBadges:
    report
  • TomLiotta
    Better would be to start commitment control, run the UPDATE, and then commit the updates. Simple and allows recovery if something unexpected happens in the middle. (Power fails, disk drive dies, etc.) Tom p.s. I tend to to run WITH 'NC' myself even though I know better.
    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