420 pts.
 Single commitment control in RPGLE program
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
ASKED: May 12, 2011  4:18 PM
UPDATED: May 17, 2011  9:01 PM
  Help
 Approved Answer - Chosen by munduuu (Question Asker)

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

ANSWERED:  May 17, 2011  9:01 PM (GMT)  by munduuu

 
Other Answers:
Last Wiki Answer Submitted:  June 27, 2012  5:03 pm  by    0 pts.
Latest Answer Wiki Contributors: 
To see other answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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

 108,135 pts.

 

Tom, I am calling this pgm from command prompt and this is *PGM object .Commitment control is *none

 420 pts.

 

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 pts.