How to call ENDCMTCTL with pending changes?

5.1k Views Asked by At

My iSeries ILE program crashed with uncommitted changes. Now I wish to end commitment control (to start program again, program starts commitment control itself) with ENDCMTCTL, but it fails with message:

CPF8355 - ENDCMTCTL not allowed. Pending changes active

Is there a way to rollback/commit changes and end commitment control proper way? My more experienced colleagues suggest only to sign out and start new session.

Edit

I have tried WRKCMTDFN and all actions in it with no success. Force rollback and Force commit failed with message:

CPD83ED -Commitment definition not eligible for forced rollback ... 
... 2 -- The logical unit of work, for this commitment definition, is not in
an undecided state.
2

There are 2 best solutions below

5
On BEST ANSWER

The message ID is probably CPF8355, and the second level text is helpful to understand the situation:

 Cause . . . . . :   An attempt was made to end commitment control for         
   commitment definition &1. However, there are one or more active resources   
   under commitment control for the commitment definition. The resources could 
   be one of the following:                                                    
     -- Local files                                                            
     -- Remote files                                                           
     -- API commitment resources                                               
     -- Remote SQL database                                                    

Use WRKJOB OPTION(*CMTCTL) to see which resources are still open and under commitment control. If there are open files, the program should close them before trying ENDCMTCTL. If this is a case where there are repeated CALLs to an RPG program which leaves files open for performance reasons, CALL it one last time with a special parameter which will tell it to close the files. Alternatively, if it's an ILE program, consider RCLACTGRP.

2
On

After reading the documentation it appears there is not much else you can do. I would have expected you to be presented with an option to commit changes or roll them back based on this:

If there are uncommitted changes for an interactive job, a message is sent asking the user whether the changes should be committed or rolled back before a commitment definition is ended. For a batch job, the changes are rolled back.

Because you did not get this option I think your job has already begun the commit (or roll back) process and you cannot change it at this point. So you're left with the sole "option" of logging off - which will end your job and associated commitment control.