End System (ENDSYS)
|Where allowed to run: Interactive environments (*INTERACT *IPGM *IREXX *EXEC)
The End System (ENDSYS) command ends most activity on the system and leaves the system in a condition in which only the console is active in the controlling subsystem. This is done so that the operator can do things like backing up the system or loading new programs. This condition is called the restricted state and is required for operations like saving the system or reclaiming storage. If two jobs are active in the controlling subsystem at the console, neither of the jobs is forced to end. The ENDSYS command cannot complete running until you end one of the jobs (either by signing off in one job or by ending one job from the other).
All active subsystems are notified that an end system operation is in process. No new jobs or routing steps can be accepted by the subsystems. This command also specifies what happens to all active work.
Interactive jobs that are transferred to a job queue by the Transfer Job (TFRJOB) command are ended as part of subsystem ending. 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.
Restriction: This command can be entered only in an interactive job in the controlling subsystem. To use this command, the user must have job control (*JOBCTL) authority. This command is not allowed in a pass-through job or in a workstation function job.
|OPTION||How to end||*CNTRLD, *IMMED||Optional, Positional 1|
|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
|CONFIRM||Confirm||*ENVVAR, *YES, *NO||Optional|
How to end (OPTION)
Specifies whether all active jobs are ended in a controlled manner (which lets the application programs perform end of processing) or immediately. In either case, the system performs certain job cleanup functions.
- 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 the controlled end operation is allowed. If this amount of time is exceeded and the end operation is not complete, any jobs still being processed are ended immediately, except for those running long-running instructions.
- 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 ENDSYS 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 ENDSYS 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.
Specifies whether the request should be confirmed before the system is ended.
- The value in environment variable QIBM_ENDSYS_CONFIRM is used to determine whether the request should be confirmed. If the value is set to *YES or *NO, the action described below for that value is taken. If the environment variable is not defined or not set to one of these values, then there is no confirmation.
- A confirmation panel is displayed when the ENDSYS command is issued.
- There is no confirmation when the ENDSYS command is issued.
Example 1: Ending System Activity
This command ends the system activity after all active jobs in the system are allowed to perform their own end of processes. The amount of time the end can take is not limited.
Example 2: Ending System Activity After Jobs are Ended
This command ends system activity after all active jobs are immediately ended.
- Wait time expired for system response.
- ENDSYS not allowed when console powered or varied off.
- 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.
- Command can only be run in controlling subsystem.
- Controlling subsystem already ending to single job.
- Function check occurred in system arbiter.
- Exit Point Program &1 cannot enter restricted state.