End Subsystem (ENDSBS)
|Where allowed to run: All environments (*ALL)
The End Subsystem (ENDSBS) command ends the specified subsystem (or all active subsystems) and specifies what happens to active work being processed. No new jobs or routing steps are started in the subsystem or subsystems after this command is run.
Interactive jobs that have been transferred to a job queue by the Transfer Job (TFRJOB) command are ended as part of ending the subsystem. If an initial program load (IPL) occurs while either a batch or interactive job is on a job queue (because of the TFRJOB command), that job is removed from the job queue during IPL and its job log is produced.
You can specify that the application programs running in the subsystem are given time to control end-of-job processing. If no time is given or if cleanup cannot be performed within the given time, the system performs minimal end-of-job processing, which can include:
- Closing the database files.
- Spooling the job log to an output queue.
- Cleaning up internal objects in the operating system.
- Showing the end-of-job display (for interactive jobs).
- Completing commitment control processing.
- To use this command, you must have job control (*JOBCTL) special authority.
- If the controlling subsystem is being ended, because either its name or *ALL is specified for the Subsystem (SBS) parameter, then this command can be run only in
- an interactive job that is in the controlling subsystem and only from a work station (associated with the interactive job) whose work station entry in the controlling subsystem description specifies *SIGNON for the Allocation (AT) parameter. For more information, see the Add Work Station Entry (ADDWSE) command.
- or a batch job running in the controlling subsystem, initiated from a job queue, with the BCHTIMLMT parameter and SBS(*ALL) specified.
ENDSBS SBS(*ALL) is not allowed in a TELNET job, pass-through job, or in a workstation function job.
- ENDSBS SBS(*ALL) is not allowed in a batch job that allows multiple threads.
|SBS||Subsystem||Name, *ALL||Required, Positional 1|
|OPTION||How to end||*CNTRLD, *IMMED||Optional, Positional 2|
|DELAY||Controlled end delay time||0-99999, *NOLIMIT||Optional|
|ENDSBSOPT||End subsystem option||Single values: *DFT
Other values (up to 3 repetitions): *NOJOBLOG, *CHGPTY, *CHGTSL
|BCHTIMLMT||Batch time limit||5-9999, *NOMAX||Optional|
|ABNENDDLY||Abnormal end delay time||10-999, *NOLIMIT||Optional|
Specifies the name of the subsystem to be ended, or it specifies that all active subsystems are to be ended.
This is a required parameter.
- All the subsystems that are currently active are being ended. All jobs are ended except the job in which this command is entered. When this value is specified, the QSYSOPR message queue should be in break delivery mode in the job issuing the end subsystem command.
- Specify the simple name of the subsystem to be ended. If the subsystem specified is the controlling subsystem, the interactive job from which the command was issued remains active. Also, if the subsystem specified is the controlling subsystem and the job that issues this command is one of two secondary jobs that are active at the work station, neither of the jobs is forced to end. The controlling subsystem does not end until you end one of the jobs (either by signing off in one job or by ending one job from the other).
How to end (OPTION)
Specifies whether jobs in the subsystem are ended in a controlled manner (ending jobs in a controlled manner lets the application programs perform end-of-job processing) or immediately.
- The jobs are ended in a controlled manner. This allows the programs that are running to perform cleanup (end of job processing). When a job being ended has a signal handling procedure for the asynchronous signal SIGTERM, the SIGTERM signal is generated for that job. The application has the amount of time specified for the DELAY parameter to complete cleanup before the job is ended.
- The jobs are ended immediately. When a job being ended has a signal handling procedure for the asynchronous signal SIGTERM, the SIGTERM signal is generated for that job and the QENDJOBLMT system value specifies a time limit. Other than by handling the SIGTERM signal, the programs that are running are not allowed to perform any cleanup.
Note: The *IMMED value might cause undesirable results if data has been partially updated. This value should be used only after a controlled end has been attempted unsuccessfully.
Controlled end delay time (DELAY)
Specifies the amount of time (in seconds) that is allowed to complete the controlled subsystem end operation. If this amount of time is exceeded and the end operation is not complete, any jobs still being processed in the subsystem are ended immediately.
- The amount of time in which to complete a controlled end is not limited.
- Specify the number of seconds in which the end operation is allowed to complete.
End subsystem option (ENDSBSOPT)
Specifies the options to take when ending the active subsystems. In general, specifying these options will improve the performance of the ENDSBS command. Each option has certain side effects that you need to analyze before using that option.
This parameter has no effect on jobs that are already in the ending status.
- The subsystems will end with no special ending options.
- Joblogs will be produced.
- The run priority will not change.
- The timeslice value will not change.
- No joblogs will be created for jobs that are ended due to this command being invoked. This includes subsystem monitor jobs and all user jobs in the subsystem. This option can significantly reduce the amount of time necessary to complete the ENDSBS command. However, if a problem occurs in a job, there will be no joblog to record the problem, which may make problem diagnosis difficult or impossible.
- The CPU priority of jobs that are ending is changed to a higher value (worse priority). The remaining active jobs on the system may have better performance when *CHGPTY is specified. However, jobs that are ending may take longer to finish. This option is ignored if the subsystem is ending controlled. But if the DELAY time limit expires, this option will take effect immediately.
- The timeslice of jobs that are ending is changed to a lower value. The remaining active jobs on the system may have better performance when *CHGTSL is specified. However, jobs that are ending may take longer to finish. This option is ignored if the subsystem is ending controlled. But if the DELAY time limit expires, this option will take effect immediately.
Note: Specifying *CHGPTY and *CHGTSL will reduce the impact on other active jobs on the system, but this may cause undesirable delays if there are active workstations that were allocated to the ending subsystem. It may take longer for those workstations to have their signon screens re-displayed since the job using the display must end before the workstation is ready to be allocated to another subsystem.
Batch time limit (BCHTIMLMT)
Specifies the amount of time (in minutes) that the system will run in batch restricted state. This parameter is only valid when ending all subsystems from a batch job running in the controlling subsystem. Under this condition, a parameter value must be specified. When this parameter is specified, the system will be ended to the restricted state, with only the batch job running the ENDSBS command remaining active. While the system is in this restricted state, system reference code A900 3C70 is displayed. If the specified time limit is reached, the batch job will be ended and the controlling subsystem restarted. When the job ends, the controlling subsystem will start.
Note: This parameter is recommended only for an application that requires no operator interaction.
- There is no time limit for the batch restricted function. The system will remain in the restricted state until the job ends, the Start Subsystem (STRSBS) command is used, or the Dedicated Service Tools (DST) option to end batch restricted state is used.
- Specify the time limit (in minutes) that the batch restricted function is allowed to run.
Abnormal end delay time (ABNENDDLY)
Specifies the amount of time (in minutes) that is allowed for the immediate subsystem end operation to complete. If this amount of time is exceeded and the end operation is not complete, any jobs still being processed in the subsystem are ended abnormally. If a job is ended abnormally, the next system end is marked as abnormal. The delay time may be extended if there are jobs with SIGTERM handlers active that have not ended.
- The amount of time in which to complete an immediate end is not limited.
- Specify the number of minutes in which the immediate end operation is allowed to complete.
ENDSBS SBS(QBATCH) OPTION(*CNTRLD) DELAY(60)
This command ends all active jobs in the QBATCH subsystem and ends the subsystem. The active jobs are allowed 60 seconds to perform application-provided end-of-job processing.
- Wait time expired for system response.
- System ending with *CNTRLD option.
- System ending with *IMMED option.
- All subsystems ending with *CNTRLD option.
- Subsystems ending with *IMMED option.
- System powering down with *CNTRLD option.
- System powering down with *IMMED option.
- No authority to use command.
- ENDSBS *ALL not allowed in current environment.
- Ending controlling subsystem &1 not allowed.
- No subsystem &1 active.
- Subsystem &1 ending with *CNTRLD option.
- Subsystem &1 already ending with *IMMED option.
- Controlling subsystem already ending to a single job.
- Function check occurred in system arbiter.
- Exit Point Program &1 cannot enter restricted state.