5 pts.
 iSeries – ending jobs in one sbs
Hi, in our application we need to end all jobs in sbs Qbatch (not the subsystem, but jobs only). Do you know how to do it?

Software/Hardware used:
ASKED: May 12, 2008  9:06 AM
UPDATED: April 21, 2010  6:36 AM

Answer Wiki:
You can writhe a CL program that will capture the entire subsystem into a physical file and read each job in the file and capture the number, user and name. Then run a command to end that job with the prams captured.
Last Wiki Answer Submitted:  May 12, 2008  3:43 pm  by  SOUTHEAST   30 pts.
All Answer Wiki Contributors:  SOUTHEAST   30 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

There is a command on the iSeries, CLRJOBQ JOBQ(*LIBL/XXXXXXXXXX) LOG(*JOB) , if you want to end all jobs.

 35 pts.

 

This will only cancel jobs waiting in the queue for a subsystem not the currently running jobs.

 50 pts.

 

If you want to end all jobs in the subsystem why not do:

ENDSBS SBS(QBATCH)
OPTION(*CNTRLD)
DELAY(30)

DLYJOB DLY(60) /* give enough time to end all jobs */

STRSBS SBSD(QBATCH)

 50 pts.

 

I have to ask. Why would you end jobs that are running? You may be creating a mess that needs cleaning up. What if you are in the middle of updating? Sounds as if you are trying to treat the system like a PC. I would look at QBATCH first to see average runtimes(assume 1 hour) then I would use a CL to put QBATCH on hold 65 minutes before I needed it shut down. Do the function you need and as a last step release the job queue. No mess worry about afterwords.

 90 pts.

 

If you want to end all jobs in the subsystem why not do:

ENDSBS SBS(QBATCH)
OPTION(*CNTRLD)
DELAY(30)

DLYJOB DLY(60) /* give enough time to end all jobs */

The problem there is the case where a job is in an error state such that it cannot end. Once you issue ENDSBS, it can’t be undone. The subsystem can’t be restarted since it hasn’t ended yet. And the subsystem can’t be used because no new jobs will start in a subsystem that is in the process of ending.

It runs the risk of having an unusable subsystem until the entire system is IPLed.

Much better simply to hold job queues feeding the subsystem, list jobs running in the subsystem and end those jobs. If any problems arise, you can continue without significant concern for any job that is locked up.

Tom

 110,035 pts.