The End Subsystem 2 command is similar to the system ENDSBS command
except ENDSBS2 does not complete until the subsystem has reached an
inactive state. Wait time options may be specified. ENDSBS2
simplifies writing a CL program that ensures a subsystem has ended
properly.
A typical command would be:
ENDSBS2 SBSD(xxx) ENDJOBWAIT(180) ACTION(*IMMEDEND)
IMMEDWAIT(180) SBSWAIT(180)
The same values as used for the defaults for the xxxWAIT parameters
have been specified. The following would occur:
** The following system command would be run for the named
subsystem:
ENDSBS SBS(xxx) OPTION(*CNTRLD) DELAY(*NOLIMT)
This signals a shutdown to any active jobs and prevents new
jobs from starting. No messages are sent to the interactive
users. A shutdown request may be checked in a program such as
with the RPG SHTDN operation.
** The ENDJOBWAIT value of 180 seconds specifies the maximum
amount of time that ENDSBS2 will wait for jobs to be ended.
Rather than waiting for the full amount time and then
checking, ENDSBS2 has an internal 10 second loop delay and
then checks if any jobs are still active in the subsystem.
If no more jobs are active, the status of the subsystem is
checked as described in a later step.
** If an ENDJOBWAIT timeout (180 seconds is the default) occurs
where one or more jobs are still active, ENDSBS2 checks the
value of the ACTION parameter. If *ESCMSG is specified, the
TAA9892 escape message is sent and ENDSBS2 ends abnormally.
If *IMMEDEND is specified, the following system command would
be run for the named subsystem.
ENDSBS SBS(xxx) OPTION(*IMMED) DELAY(*NOLIMIT)
If the jobs have not ended after the IMMEDWAIT value (180
seconds is the default), the escape message TAA9893 is sent.
Instead of waiting for the full IMMEDWAIT value, ENDSBS2 has
an internal 10 second delay loop which checks if all jobs have
ended.
** When no jobs exist in the subsystem, an internal 10 second
loop occurs waiting for the system to reach an inactive state.
If the the *INACTIVE state cannot be reached in the time
specified for the SBSWAIT parameter (180 seconds is the
default), the escape message TAA9894 is sent.
If the subsystem reaches the *INACTIVE state, the ENDSBS2
command completes normally. If the subsystem is already in
the *INACTIVE state when ENDSBS2 is run, the command completes
normally.
Notifying interactive jobs of the planned termination
-----------------------------------------------------
You may inform any existing users that the subsystem is ending by
sending a break message with the SNDBRKACT TAA command, use a delay,
and then ENDSBS2 such as:
SNDBRKACT MSG('Please signoff in 5 minutes or +
your job will be ended abnormally') +
SBS(xxx)
ENDSBS SBS(xxx)
DLYJOB DLY(300)
ENDSBS2 SBS(xxx)
The ENDSBS system command will prevent new jobs from signing on by
using the default of OPTION(*CNTRLD). This same command is also used
within the ENDSBS2 processing. ENDSBS for the same subsystem may be
used multiple times as long as OPTION(*CNTRLD) is specified.
After a 300 second delay, ENDSBS2 would be used to ensure the
subsystem has reached an inactive state.
ENDSBS2 escape messages you can monitor for
-------------------------------------------
TAA9892 Active jobs still exist after ENDJOBWAIT
timeout and ACTION(*ESCMSG) was specified
TAA9893 Active jobs still exist after IMMEDWAIT timeout
TAA9894 *INACTIVE state not reached after SBSWAIT timeout
Escape messages from based on functions will be re-sent.
Command parameters *CMD
------------------
SBSD The qualified name of the subsystem to end. The
library value defaults to *LIBL. *CURLIB may also
be used.
If the subsystem is already in an *INACTIVE state,
ENDSBS2 ends normally.
ENDJOBWAIT The number of seconds to wait for the jobs in the
subsystem to end. The default is 180 seconds. If
active jobs still exist after the timeout, the
ACTION parameter value is used to determine the next
processing step.
If the ENDJOBWAIT value exceeds 10 seconds, a check
is made at every 10 second interval to determine if
active jobs still exist.
ACTION The action to take if jobs still exist after the
ENDJOBWAIT timeout.
*IMMEDEND is the default which causes ENDSBS
OPTION(*IMMED) to be used. This causes the system
to end the jobs abnormally.
*ESCMSG may be specified to cause ENDSBS2 to send
the TAA9892 escape message.
IMMEDWAIT The number of seconds to wait if ACTION(*IMMEDEND)
was specified and jobs are still active after ENDSBS
OPTION(*IMMED) was used. The default is 180
seconds. If a timeout occurs, TAA9893 is sent as an
escape message.
If the IMMEDWAIT value exceeds 10 seconds, a check
is made at every 10 second interval to determine if
active jobs exist.
SBSWAIT The number of seconds to wait when no jobs exist in
the subsystem and the subsystem is attempting to
reach the *INACTIVE state. The default is 180
seconds. If a timeout occurs, TAA9894 is sent as an
escape message.
If the SBSWAIT value exceeds 10 seconds, a check is
made at every 10 second interval to determine if
active jobs exist.
Restrictions
------------
*JOBCTL special authority is required.
Prerequisites
-------------
The following TAA Tools must be on your system:
CHKJOBCTL Check *JOBCTL special authority
CHKOBJ3 Check object 3
EDTVAR Edit variable
RTVSBSD Retrieve subsystem description
SNDCOMPMSG Send completion message
SNDESCINF Send escape information
SNDESCMSG Send escape message
SNDSTSMSG Send status message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
ENDSBS2 *CMD TAAJODV QATTCMD
TAAJODVC *PGM CLP TAAJODVC QATTCL
|