# Ending a control region (ENDCICS) - IBM - AS/400

CL command defaults
The defaults given in the CL command description are those that are supplied with the OS/400 system. You should check that your installation has not made any changes to these command default parameters.

ENDCICS

Flowchart

Notes:

1. The DELAY parameter is only valid when OPTION(*CNTRLD) is specified.
2. All parameters preceding this point can be specified positionally.

Function
The ENDCICS CL command is used to initiate a request to end a specified control region and control the way in which work being processed by that control region and its associated shells is shut down.

In its simplest form, this command consists of:

ENDCICS CTLRGN(sysid)
Once a request to end a control region has been initiated, no new shells may be started for that control region until shutdown has completed and the control region has been restarted.

During control region shutdown, CICS/400 initiates requests to end all the associated shells (user or batch). In a “controlled” shutdown, specifying OPTION(*CNTRLD), the control region waits for the time specified on the DELAY option (by default the wait is indefinite) for acknowledgments from all shells that shutdown processing is complete. When the wait time expires or if an “immediate” shutdown, specifying OPTION (*IMMED), is selected, the control region completes shutdown processing and any shells remaining active may abend or report unexpected return codes.

Required parameters

CTLRGN
The name of the CICS control region to be shut down, also known as the CICS system ID.

control-region: The name of the control region may be up to four characters in length. The first character must be alphabetic, or one of the special characters, $, @, or #. The remaining characters can be alphanumeric or$, @, or #.

Optional parameters

OPTION
Identifies the method used to shut down the CICS control region. Possible values are:
*CNTRLD: All associated CICS shells are automatically shut down if they are idle or when the CICS transaction that is currently being executed is completed.

*IMMED: All associated CICS shells are shut down immediately. Any CICS transactions that are being executed are not allowed to perform any cleanup. This parameter might cause loss of data; therefore, it should be used only after a controlled shutdown has been unsuccessful. If this fails to shut down the control region, use the ENDJOB command. It may be that a shell has locked a part of the control region, in which case the shell will also need to be closed using an ENDJOB command. If, after 10 minutes, either the shell or the control region has not ended, issue an ENDJOBABN command for both the control region and the shell.

DELAY
Indicates the amount of time (in seconds) that is allowed to complete the controlled CICS control region shutdown. At the end of this time, or after 24 hours, whichever is the shorter, the control region is shut down immediately,and all shells associated with the control region are ended. Possible values are:

*NOLIMIT: The amount of time in which to complete a controlled shutdown is not limited. If the controlled shutdown has not completed after 24 hours, an immediate shutdown will take place.

time-delay:Valid values are in the range 1 through 99 999.

Examples
The ENDCICS command issues a controlled shutdown of the CICS control region called “TEST”. The controlled shutdown lasts for 360 seconds. If in that time all associated CICS shells have not shut down, then an immediate shutdown will be issued automatically.

ENDCICS CTLRGN(TEST) OPTION(*CNTRLD) DELAY(360)