I use it for testing to see if a GL transaction is ok.
Code
I use it for testing to see if a GL transaction is ok.
Code
Check out the example provided here: href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books_web/c0925076305.htm">Example of how to use commit or Rollback in ILE RPG You might want to read the whole section if you are not familiar with how to get commitment control to work in an RPG program.
You need to start commitment control, before you're allowed to open a file with COMMIT on F-specs (in RPG III, it was a continuation line with KCOMIT). If you have no need for a CL, other than to start commitment control, call the RPG, then end commitment control, you could declare the file(s) as USROPN, and call QCMDEXC to do the STRCMTCTL end ENDCMTCTL. No matter how you do it, the sequence is: 1)Start commitment control with STRCMTCTL command 2)Open file with COMMIT keyword 3)Issue I/Os, COMMIT, and ROLBK operations 4)Close files with COMMIT keyword 5)End commitment control with ENDCMTCTL command Typically I've seen CL with STRCMTCTL, call RPG, ENDCMTCTL. The RPG has one or more files with COMMIT keyword. The RPG also has its own COMMITs and ROLBKs. It's possible to have the RPG call a 2nd CL to do COMMIT and ROLBK, but I can't think of why you would need to.
I guess you could use this:
Code
Hello, I looking for an example of how to COMMIT/ROLLBACK directly in RPGLE. All the examples that I see needs a CL. For example: PGM STRCMTCTL LCKLVL(*CHG) CALL PGM(*LIBL/CCTEST2) COMMIT CALL PGM(*LIBL/CCTEST2) ROLLBACK ENDCMTCTL RETURN ENDPGM Is there a way to insert directly in the RPG? (The only way that I see is a PGM that calls a CL that receives a parameter COMMIT or ROLLBACK). Thanks.