How prestart jobs work

A prestart job is a job that is started before the work arrives. This allows the system to handle a request for work without the delay caused by starting a new job.

A prestart job is a unique type of batch job. This means that the job has a job type of 'B' and a job subtype of 'J'. The enhanced job type further defines the job as a prestart job (1610), prestart batch job (1620), or prestart communications job (1630). The enhanced job type describes how the prestart job accepts work requests. If the program running in the prestart job uses the communications interface for accepting work, the job is a prestart communications job. If the program running in the prestart job accepts work through a batch work interface, the job is a prestart batch job. If the program has not yet reached the point of accepting work, the job is just a prestart job. Prestart batch jobs are often referred to as server jobs because they provide service for the work requests.

A communications work request is handled by the subsystem that has the required communications device allocated. A batch work request is typically handled by one of the basic subsystems that are shipped with the system: QSYSWRK, QUSRWRK, or QSERVER.

Prestart jobs are started based on the information contained in the prestart job entries. The Start jobs (STRJOBS) parameter can specify that the prestart jobs are started when the subsystem is started or when the Start Prestart Jobs (STRPJ) command is entered. The Initial number of jobs (INLJOBS) parameter determines the number of prestart jobs that initially start for a program.

As work requests arrive, more prestart jobs may be needed. The Threshold (THRESHOLD) parameter tells when to start more jobs. When the number of prestart jobs available to handle a request drops below the value specified by the THRESHOLD parameter, the additional jobs are started. The Additional number of jobs (ADLJOBS) parameter tells how many more jobs to start.

You need to make sure that there are enough jobs to handle work requests without unnecessary delays. You can use the information from the Display Active Prestart Jobs (DSPACTPJ) command to see if any work requests, referred to as "program start requests" in the DSPACTPJ information, had to wait for jobs to become available. Increase the value of the THRESHOLD parameter until DSPACTPJ show that no work requests ever need to wait.

Some prestart jobs handle a work request and then become available to handle another work request. The Maximum number of uses (MAXUSE) parameter allows you to specify how many work requests these prestart jobs handle. Some prestart jobs handle a single work request and then end, ignoring the MAXUSE value. Whether the prestart job handles multiple work requests or handles only a single work request is determined by the program running in the prestart job.

When the prestart job ends after handling at least one work request, the subsystem compares the number of jobs that are still running to the number specified in the INLJOBS parameter. If the number of jobs remaining is less than INLJOBS, the subsystem starts another job.

If a prestart job ends without handling at least one work request and the job was not ended by the End Job (ENDJOB) command, the prestart job program is considered to be in error. The subsystem ends the prestart job entry in a controlled manner. This allows jobs that are servicing a work request to complete that request, but prevents the subsystem from starting additional jobs.

The subsystem periodically checks the number of prestart jobs to determine if there are excessive available prestart jobs. A prestart job is available when it is waiting for a work request. If the number of available prestart jobs is greater than the THRESHOLD parameter and the total number of prestart jobs is greater than the INLJOBS parameter, the subsystem ends some of the available prestart jobs. For prestart jobs that handle more than one work request, you should use the DSPACTPJ information to determine your peak load, add this number to the value of the THRESHOLD parameter, and set the INLJOBS parameter to the sum. This prevents the subsystem from considering available jobs to be excessive unless the workload is larger than this expected peak load.

Related concepts
Prestart job name
Prestart job entries
Security and prestart jobs
Performance tips for prestart jobs
Spooled file and the prestart job entry
Related information
Tuning prestart job entries
Subsystem Configuration