9.5.1 Implicitly Defining a Transaction in a Service Routine
You can implicitly place a service routine in transaction mode
by setting the system parameter AUTOTRAN
in the
configuration file. If you set AUTOTRAN
to
Y
, the system automatically starts a transaction in
the service subroutine when a request is received from another
process.
When implicitly defining a transaction, observe the following rules:
- If a process requests a service from another process when the calling process is not in transaction mode and the
AUTOTRAN
system parameter is set to start a transaction, the system initiates a transaction - If a process that is already in transaction mode requests a service from another process, the system’s first response is to determine whether or not the caller has its
flags
parameter set toTPNOTRAN
.If the
flags
argument is not set toTPNOTRAN
, then the system places the called process in transaction mode through the “rule of propagation.” The system does not check theAUTOTRAN
parameter.If the
flags
argument is set toTPNOTRAN
, the services performed by the called process are not included in the current transaction (that is, the propagation rule is suppressed). The system checks theAUTOTRAN
parameter.- If
AUTOTRAN
is set toN
(or if it is not set), the system does not place the called process in transaction mode. - If
AUTOTRAN
is set toY
, the system places the called process in transaction mode, but treats it as a new transaction.
- If
Note:
Because a service can be placed in transaction mode automatically, it is possible for a service with theTPNOTRAN
flag set to call services that have the AUTOTRAN
parameter set. If such a service requests another service, the flags
member of the service information structure returns TPTRAN
when queried. For example, if the call is made with the communication flags
member set to TPNOTRAN
| TPNOREPLY
, and the service automatically starts a transaction when called, the flags
member of the information structure is set to TPTRAN
| TPNOREPLY
.
Parent topic: Implicitly Defining a Global Transaction