Building the switch-load file

Each RM defined in the CICS environment must provide an XA switch-load file. The switch-load file is a component of your CICS configuration; it is referenced in the XAD. It contains the RM’s name, a flag, a version number and a set of non-null pointers to the RM’s entry points, provided by the DTM XA Interface.

All of the Sybase XADs share a single switch-load file. You can build your Sybase switch-load file using the file sybasexa.c, which is located in:

$SYBASE/$SYBASE_OCS/sample/xa-dtm/cics/switch

The following is a listing of sybasexa.c:

/*
 **
 ** sybasexa.c
 **
 ** The sybasexa routine references the Sybase xa
 ** switch structure named "sybase_TXS_xa_switch". 
 ** The switch structure is part of the
 ** XA product library "libdtmxa.a".
 **
 ** See your CICS documentation for details on the
 ** switch-load file.
 */
 
 #include <stdio.h> 
 #include <tmxa/xa.h>
 
 extern struct xa_switch_t sybase_TXS_xa_switch;
 extern struct xa_switch_t RegXA_xa_switch;
 extern struct xa_switch_t *cics_xa_switch;
 
 struct xa_switch_t *sybasexa(void)
 {
     cics_xa_switch = &sybase_TXS_xa_switch;
 
     cics_xa_init();
 
     return(&RegXA_xa_switch);
 }

This source code references the Sybase XA switch structure, which is global to the DTM XA Interface and defined as follows:

struct xa_switch_t sybase_TXS_xa_switch = 
 {
 "SYBASE_SQL_SERVER",
 TMNOFLAGS,
 0,
 xa_open,
 xa_close,
 xa_start,
 xa_end,
 xa_rollback,
 xa_prepare,
 xa_commit,
 xa_recover,
 xa_forget,
 xa_complete
 };

The use of TMNOFLAGS specifies that the DTM XA Interface supports thread migration but does not support dynamic registration or asynchronous operations. For a description of these features, see the X/Open CAE Specification (December 1991) Distributed Transaction Processing: The XA Specification.