The need may arise when all jobs from a specific table or all jobs selected according to other criteria need to be deleted if a problem arises during batch processing. |
The following video demonstrates this solution:
This can be done on the Control-M/Server host with a combination of the ctmpsm utility, the ctmkilljob utility, and, if desired, a custom script.
The following ctmpsm command can be used to get a listing of all jobs that are in the AJF: ctmpsm -LISTALL ALL To select only jobs in a specific folder (scheduling table), use this command: ctmpsm -LISTAJFFLD <tablename> Replace "<tablename>" with the name of the specific folder (scheduling table) you are searching. example output: ORDERID JOBNAME TYPE ODATE STATE STATUS FROMTIME UNTIL -------- ----------------- ---- ------- ------- ------ -------- ----- 0000001v DAILY_DIR CMD 20100215 Post pro OK 0000001w DAILY_DIR_CYCLIC CMD 20100215 Post pro OK This output will contain the Order ID for each job (needed for the commands to kill, hold, and delete) To kill jobs in Executing status: ctmkilljob -ORDERID <uniqueOrderID> Replace "<uniqueOrderID>" with the actual order ID from the ctmpsm list output. To hold free jobs that are not in "Executing" or "Submitted" status: ctmpsm -UPDATEAJF <order_id> HOLD Replace "<order_id>" with the actual order ID from the ctmpsm list output. To free held jobs: ctmpsm -UPDATEAJF <order_id> FREE Replace "<order_id>" with the actual order ID from the ctmpsm list output. To mark held jobs that are not in "Executing" or "Submitted" status for deletion: ctmpsm -UPDATEAJF <order_id> DELETE Replace "<order_id>" with the actual order ID from the ctmpsm list output. To run this repeatedly for multiple jobs meeting particular criteria, you can write your custom script to run the above list commands, parse the output, and then loop through the kill, hold, and delete commands above for each order ID as appropriate. Notes: - Jobs with Executing or Submitted status cannot be deleted. - Jobs with Executin or Submitted state cannot be deleted, even if is held. - Running many utilities quickly in succession can degrade Control-M/Server performance. - You can develop your custom script to parse the output from the list command to filter only for jobs with an ODATE more than seven days ago or to make any more complicated logic. - To provide a feature allowing one to remove active jobs older than a certain number of days that requires less custom scripting, the following Request For Enhancement (RFE) has been opened for consideration in a future release: QM002262558 - For jobs in "Executing" status that have already ended on the Control-M/Agent and cannot be killed with ctmkilljob, please see article 000208257. |