Coding a CPT application to handle abandoned and inactive sessions
A number of CPT sites have problems getting rid of abandoned CPT sessions. These occur when a the CICS region issues GIVE calls (to pass a session) and there is not any corresponding CICS task issuing a TAKE call to take ownership for the CPT session.
We wrote the STEAR (Session Timeout Exit Alert and Removal) enhancement to remove abandoned CPT sessions and CICS/CPT sessions which stop performing work for a CPT session.
STEAR was introduced by PTF PP10736.
A cross zone query for MOD T09TEPCK will give you the STEAR level inside CPT.
Other fixes where CPT STEAR logic has been modified:
RO64971 - Latest CPT STEAR related PTF as of May 2014
STEAR functionality is turned on inside CPT by placing the T09MANAG into the T09CONxx configuration file.
Assemble and link the T09CONxx configuration file then restart CICS and CPT.
PTF PP10736 requires sites to add CSD definitions for new programs and transactions.
CPT systems programmers must place the following CSD definitions into their CPT Group (T09CPT):
DEFINE PROG (T09TEPCK) LANG(ASSEMBLER) DA(ANY) GROUP(T09CPT) EXECK(CICS) DEFINE TRANS (IPUE) PROG(T09TEPCK) TASKDATALOC(ANY) GROUP(T09CPT) TASKDATAK(CICS)
A new parameter STIMEOUT= P | E (default P)
can be placed on the T09MLSTN statement in the T09CONxx configuration file.
When a site sets STIMEOUT=P then CPT sessions participate in the closing of sessions which exceed either the GIVE and/or Session inactivity timeout.
When a site sets STIMEOUT=E then CPT sessions do not participate in either the GIVE and/or Session inactivity timeout.
The T09MANAG macro is documented in chapter 2 of the CPT Administrator Guide.
The T09MANAG macro has the following parameters:
CPT session. CICS Security may need to be updated so the IPUE transaction can purge the CICS tasks associated with the CPT sessions.
When a session exceeds either the GIVE or session inactivity timeout.
The CPT STEAR program will CLOSE the CPT session and optionally purge any CICS task associated with the session. No CICS tasks will be purged when a session exceeds the GIVE timeout as no CICS task is associated with any CPT session is in the GIVE state. CICS Security may need to be updated so the IPUE transaction can purge the CICS tasks associated with the CPT sessions.
From the CPT Administrators Guide:
Defines the session management related parameters.
[ GTIMEOUT = GIVE timeout ]
[ PURGETO = N | Y ]
[ STIMEOUT = Session timeout ]
[ TTIMEOUT = IPUE ]
GTIMEOUT sets the maximum number of seconds a session will allow a CPT session to be in the GIVE state before a corresponding TAKE should take ownership of a session. The CPT STEAR process monitors CPT sessions to see if any session is in the GIVE state and has exceeded the GIVE timeout. A CPT session which exceeds the GIVE timeout parameter is considered to be abandoned. The CPT STEAR process will CLOSE any CPT session which exceeds the GIVE timeout.
Specifying GTIMEOUT=0 means that there is no GIVE timeout for CPT sessions.
Session will never time out in the GIVE state.
Valid values: 0-14439.
Specifies whether the STEAR process should purge any CICS task associated with a CPT session, which has exceeded the session timeout (STIMEOUT) limit.
Specifying PURGETO=N means that that the CPT STEAR process will just CLOSE the CPT session and leave the CICS transaction alone.
Specifying PURGETO=Y means that that the CPT STEAR process will CLOSE the CPT session and then attempt to purge the CICS transaction, which was associated with the CPT session. Whenever a site sets PURGETO=Y the STEAR TTIMEOUT transaction must have the authority to purge any CICS task which might exceed the session timeout limit.
Valid values are: N | Y
STIMEOUT sets a session inactivity timeout. STIMEOUT sets the maximum number of seconds a session will allow a CPT session to be inactive before issuing another CPT command. The session inactivity timeout starts from the last time a command completes. Sessions that are currently executing a CPT command (for example, RECEIVE) will not be considered as eligible for session inactivity timeout. The CPT STEAR process monitors CPT sessions to see if any session has exceeded the session inactivity timeout. A CPT session which exceeds the session inactivity timeout parameter is considered to be abandoned.
The CPT STEAR process will CLOSE any CPT session which exceeds the session inactivity timeout.
Specifying STIMEOUT=0 means that there is no session inactivity timeout for CPT sessions. Session will never time out in an inactive state.
Server sessions do not participate in the STEAR session inactivity timeout process. Only daughter server sessions or sessions created by CONNECT will be eligible for STEAR management. One does not want a server to be shut down during the off hours due to inactivity.
Valid values: 0-14439.
TTIMEOUT names the transaction which is responsible for implementing the STEAR process. STEAR program T09TEPCK needs to be associated with the TTIIMOUT transaction.