Single commitment control in RPGLE program

435 pts.
Tags:
RPGLE Program
SQL statements
SQLRPGLE
V6R1
I have a rpgle program that uses 3-4 sql statements to update and insert data in 3-4 tables . Now what i want is that when program runs successfully then only these changes in tables should reflect else roll back . So for this is there any way to provide a single commitment control for all queries? I am on V6R1

Software/Hardware used:
as400

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: 4  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
  • TomLiotta
    There are a few possible choices depending on the structure of the job. Starting point might be a description of any existing commitment control. Is commitment control already in use in this system? Is it active when this program is called? Next, how is this program called? What calls this program? Is it called by some program or module that you can change? And is this a *PGM or is it a *MODULE or *SRVPGM? Finally, how was this program compiled? What was used for the COMMIT() parameter on the compile command? If you run DSPPGM against this program and take option 5='Display' against the module, what shows for 'Commitment control' in the "DB2 UDB for i5/OS module attributes:" section? Tom
    125,585 pointsBadges:
    report
  • munduuu
    Tom, I am calling this pgm from command prompt and this is *PGM object .Commitment control is *none
    435 pointsBadges:
    report
  • bernardcrappe
    If you want to "isolate" these statements as a transaction, you could test this
      specify a commitment level on the compilation command specify a different activation group for the program add rollback/commit statements
    25 pointsBadges:
    report
  • TomLiotta
    I am calling this pgm from command prompt... You might run a STRCMTCTL LCKLVL(*CHG) command before calling your program. After the program ends, run a COMMIT or a ROLLBACK command depending on whether the program ended properly or failed. And finally, run ENDCMTCTL to stop commitment control. You might create a basic CL program to wrap the new commands around a CALL to your program. You might also recreate your program with parameters that specify commitment control or SET OPTIONS for commitment control in the embedded SQL. You can handle commitment control outside your program or have it be built into it. It could depend on what the overall commitment control environment is on your system. Note that commitment control requires journaled files. I haven't tried it, but you might use the STRCMTCTL DFTJRN() parameter to assign a journal temporarily. 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