Problem solve Get help with specific problems with your technologies, process and projects.

Using subsystems to run job queues

We would like to see certain programs run in one job queue so that the program wouldn't be running several instances at the same time, which can cause problems in our data. We have job queues allocated to users divided by area and by the type of work. The job queue above should be supplemental. Do you have any idea if this can be done and how to do it?
You can set up a new subsystem to accomplish this, or you can modify an existing subsystem. Let's look at creating a subsystem. To do this, you can use a CRTSBSD command, like the one shown here:

CRTSBSD SBSD(YOURLIB/QBATCHS) POOLS((1 *BASE)) MAXJOBS(1) TEXT('single threaded batch Subsystem')

The MAXJOBS parameter is the key in the above command. You are saying that one job only can be active at a time in this subsystem. Once you have created the subsystem description, you will have to add a class and a routing entry to the subsystem to see that your job is run in this subsystem. Use the CRTCLS and ADDRTGE command, for example:


The help text for the CMPVAL parameter on the ADDRTGE command is: "Specifies a value that is compared with the routing data to determine whether this routing entry is used for starting a routing step for the job. If the routing data matches the routing entry compare value, that routing entry is used." You can put in *ANY or a specific value for the CMPVAL parameter. Let's just use *ANY to keep this simple.

You will also need to add a job queue entry to the subsystem. You can also specify that this job queue has a maximum width of one, as extra insurance, if you like:


Then, when you want to run jobs in this subsystem, just use the SBMJOB command, like this:

SBMJOB CMD(CALL PGM(PGMA)) JOBQ(YOURLIB/QBATCHS) PGMA is the program you want to call and by specifying the jobq for the single threaded subsystem, only one job can run this program at a time.


The Best Web Links: Tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your systems management questions fast.

Read this Search400.com Featured Topic: Take control of your iSeries.

Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.

Dig Deeper on Systems Management Tools