Important
To route a transaction defined by the DTRTRAN definition, your dynamic routing
program must set the DYRDTRRJ field of the communications area to 'N' (the
default is 'Y'). If you leave DYTDTRRJ set to 'Y', the transaction is rejected.
You can test the DYRDTRXN field to check if the transaction passed to your routing
program is defined by the DTRTRAN definition. Figure 58 contains skeleton code
for routing transactions defined by DTRTRAN.
Changing the program name
For transactions defined as DYNAMIC, on invocation of the routing program the
DYRLPROG field in the communications area contains the name of the initial
program associated with the transaction to be routed. If you decide to route the
transaction locally, you can use this field to specify an alternative program to be
run. For example, if all remote CICS regions are unavailable and the transaction
cannot be routed, you may want to run a program in the local CICS terminal-owning
region to send an appropriate message to the user.
Telling CICS whether to route or terminate a transaction
When the routing program is invoked for routing, it can choose whether the
transaction should be routed or terminated. If you want the transaction to be routed,
whether you have changed any values or not, return a zero value to CICS in field
DYRRETC of the communications area. When you return control to CICS with
return code zero, CICS first compares the returned SYSID with its own local SYSID:
v If the SYSIDs are the same (or the returned SYSID is blank) CICS executes the
transaction locally.
v If the two SYSIDs are not the same, CICS routes the transaction to the remote
CICS region, using the remote transaction name.
If you want to terminate the transaction with a message or an abend, set a return
code of X'8' (or any other non-zero return code other than X'4').
If you want to terminate the transaction without issuing a message or abend, set a
return code of X'4'.
Warning: Setting a return code of X'4' for APPC transaction routing leads to
unpredictable results, and should be avoided.
Returning a value in DYRRETC has no effect when the routing program is invoked
for notification or at termination of the transaction.
if DYRDTRXN=’Y’ then /* Is DYP invoked because of DTRTRAN */
do /* .. Yes */
Call Find_AOR(sysid) /* Select the SYSID of the AOR */
if rc=0 then /* Is AOR available? */
do /* .. Yes */
DYRRETC=RETCOD0 /* Set OK Return Code */
DYRSYSID=sysid /* Set the sysid */
DYRDTRRJ=’N’ /* Don’t reject DTRTRAN defns */
... /* Set other commarea fields */
end /* */
else /* .. No */
... /* AOR unavailable logic */
end /* */
Figure 58. Example pseudocode to route transactions defined by DTRTRAN
Chapter 17. Writing a dynamic routing program 593