End Subsystem (ENDSBS)

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:

Restrictions:

  1. To use this command, you must have job control (*JOBCTL) special authority.
  2. 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.

  3. ENDSBS SBS(*ALL) is not allowed in a batch job that allows multiple threads.

Parameters

Keyword Description Choices Notes
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
Optional
BCHTIMLMT Batch time limit 5-9999, *NOMAX Optional
ABNENDDLY Abnormal end delay time 10-999, *NOLIMIT Optional

Subsystem (SBS)

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
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.
name
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.

*CNTRLD
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.
*IMMED
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.

*NOLIMIT
The amount of time in which to complete a controlled end is not limited.
0-99999
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.

*DFT
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.
*NOJOBLOG
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.
*CHGPTY
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.
*CHGTSL
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.

*NOMAX
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.
5-9999
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.

*NOLIMIT
The amount of time in which to complete an immediate end is not limited.
10-999
Specify the number of minutes in which the immediate end operation is allowed to complete.

Examples

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.

Error messages

*ESCAPE Messages

CPF1001
Wait time expired for system response.
CPF1032
System ending with *CNTRLD option.
CPF1033
System ending with *IMMED option.
CPF1034
All subsystems ending with *CNTRLD option.
CPF1035
Subsystems ending with *IMMED option.
CPF1036
System powering down with *CNTRLD option.
CPF1037
System powering down with *IMMED option.
CPF1038
No authority to use command.
CPF1052
ENDSBS *ALL not allowed in current environment.
CPF1053
Ending controlling subsystem &1 not allowed.
CPF1054
No subsystem &1 active.
CPF1055
Subsystem &1 ending with *CNTRLD option.
CPF1056
Subsystem &1 already ending with *IMMED option.
CPF1081
Controlling subsystem already ending to a single job.
CPF1091
Function check occurred in system arbiter.
CPF18C3
Exit Point Program &1 cannot enter restricted state.