For SINIX and DC/OSx, data-conversion exits must not use DCE.
Follow these steps:
The functions generated by the crtmqcvx command use macros which are written assuming that all structures are packed; they should be amended if this is not the case.
On WebSphere MQ for AIX, Compaq Tru64 UNIX, HP-UX, Linux, and Solaris the skeleton source file is called amqsvfc0.c. On MQSeries for AT&T GIS UNIX, Compaq OpenVMS Alpha, and SINIX and DC/OSx the skeleton source file is called amqsvfcx.c.
The amqsvmha.h file contains macros that are used by the code generated by the crtmqcvx command. If the structure to be converted contains character data, then these macros call MQXCNVC.
/* Insert the functions produced by the data-conversion exit */
Here, insert the code fragment generated in step 3.
/* Insert calls to the code fragments to convert the format's */
This is followed by a commented-out call to the function ConverttagSTRUCT.
Change the name of the function to the name of the function you added in step 7a above. Remove the comment characters to activate the function. If there are several functions, create calls for each of them.
/* Insert the function prototypes for the functions produced by */
Here, insert the function prototype statements for the functions added in step 5a above.
Notes:
There are two environments to consider: non threaded and threaded.
The loadable object must have its name in upper case, for example MYFORMAT. The libmqm library should be used to resolve the calls to MQXCNVC.
In addition to creating the data-conversion exit for the basic environment, another is required in the threaded environment. This loadable object must be followed by _r (on AIX, HP-UX, Linux, and Tru64 V4.0) and _d (on Solaris) to indicate that it is a DCE-threaded version. The libmqm_r and lmqmcs_d libraries should be used to resolve the calls to MQXCNVC. Note that both loadable objects (non-threaded and threaded) are required for a threading environment.
If you are running MQI clients, all data conversion is performed by the proxy running on the machine to which the client is attached. This means that any data conversion exits are run on the server, in the environment of the proxy, and not as part of the client application.
For most platforms, the proxy/responder program is a threaded program. Consequently, the data conversion exit must be compiled with appropriate options to run in this threaded environment. Whether or not the client application is threaded is irrelevant.
On the WebSphere MQ V5 for UNIX systems, the proxy is threaded. The model of threads used depends on whether the DCE option has been installed.
The names of the routines which are called by the data-conversion exit must be made universal.
$ CC /INCLUDE_DIRECTORY=MQS_INCLUDE AMQSVFCX.C $ LINK /SYS$SHARE:[SYSLIB]MYFORMAT AMQSVFCX.OBJ,MYFORMAT/OPTIONS
The contents of MYFORMAT.OPT vary depending on which platform you are working on:
On Alpha:
SYS$SHARE:MQM/SHAREABLE SYS$SHARE:MQMCS/SHAREABLE SYMBOL_VECTOR=(MQSTART=PROCEDURE)
On VAX:
SYS$SHARE:MQM/SHAREABLE SYS$SHARE:MQMCS/SHAREABLE UNIVERSAL=MQSTART
If you are using threaded applications linked with the pthread library, you must also build a second copy of the data-conversion exit with the thread options and libraries:
$ CC /INCLUDE_DIRECTORY=MQS_INCLUDE AMQSVFCX.C $ LINK /SYS$SHARE:[SYSLIB]MYFORMAT AMQSVFCX.OBJ,MYFORMAT/OPTIONS
Again, the contents of MYFORMAT.OPT vary depending on which platform you are working on:
On Alpha:
SYS$SHARE:MQM_R/SHAREABLE SYS$SHARE:MQMCS_R/SHAREABLE SYS$SHARE:CMA$OPEN_RTL.EXE/SHAREABLE SYMBOL_VECTOR-(MQSTART=PROCEDURE)
On VAX:
SYS$SHARE:MQM_R/SHAREABLE SYS$SHARE:MQMCS_R/SHAREABLE SYS$SHARE:CMA$OPEN_RTL.EXE/SHAREABLE UNIVERSAL=MQSTART
The following sections give examples of how to compile a data conversion exit on the UNIX platforms.
On all platforms, the entry point to the module is MQStart.
$ cc -c -I/usr/mqm/inc MYFORMAT.C $ ld MYFORMAT.o -e MQStart -o MYFORMAT -bM:SRE -H512 -T512 -bE:MYFORMAT.EXP -lmqm -lc $ cp MYFORMAT /var/mqm/exits
You must build conversion exits for the threaded environment using the draft 10 Posix threads interface, which is the AIX 4.3 default.
$ xlc_r -c -I/usr/mqm/inc MYFORMAT.C $ ld MYFORMAT.o -eMQStart -o MYFORMAT_r -bm:SRE -H512 -T512 -bE:MYFORMAT.EXP \ -lmqm_r -lpthreads_compat -lpthreads -lc_r $ cp MYFORMAT_r /var/mqm/exits
$ cc -c -K PIC -I/opt/mqm/inc MYFORMAT.C $ ld -G MYFORMAT.O -o MYFORMAT $ cp MYFORMAT /opt/mqm/lib
This example shows how to compile a data-conversion exit program in a nonthreaded environment:
$ cc -std1 -c -I /opt/mqm/inc myformat.c $ cc -std1 -shared -o myformat myformat.o -L /opt/mqm/lib -lmqm -e MQStart -lc $ cp myformat /var/mqm/exits
This example shows how to compile a data-conversion exit program in a threaded environment:
$ cc -std1 -c -I /opt/mqm/inc myformat.c $ cc -std1 -shared -pthread -o myformat_r myformat.o -L /opt/mqm/lib \ -lmqm_r -e MQStart -lc $ cp myformat /var/mqm/exits
This example shows how to compile a data-conversion exit program:
$ cc -std1 -c -I /opt/mqm/inc myformat.c $ cc -std1 -shared -pthread -o myformat myformat.o -L /opt/mqm/lib \ -lmqm -e MQStart -lc $ cp myformat /var/mqm/exits
$ CC -c -Aa +z -I/opt/mqm/inc MYFORMAT.C $ ld -b MYFORMAT.o -o MYFORMAT -L /opt/mqm/lib -lmqm +IMQStart $ cp MYFORMAT /var/mqm/exits
If you are using threaded applications linked with the POSIX Draft 10 pthreads library, or you are running client applications, you must build the conversion exit for Draft 10 threads.
$ CC -c -Aa +z -I/opt/mqm/inc MYFORMAT.C $ ld -b MYFORMAT.o -o MYFORMAT_r -L/opt/mqm/lib -lmqm_r -lpthread -lc +IMQStart $ cp MYFORMAT_r /var/mqm/exits
If you are using threaded applications linked with the POSIX Draft 4 (DCE) pthreads library, or you are running client applications, you must build the conversion exit for Draft 4 threads.
$ CC -c -Aa +z -I/opt/mqm/inc -D_PTHREADS_DRAFT4 MYFORMAT.C $ ld -b MYFORMAT.o -o MYFORMAT_d -L/opt/mqm/lib -lmqm_d -ldr -lcma -lc +IMQStart $ cp MYFORMAT_d /var/mqm/exits
To compile a user exit program for a nonthreaded environment use:
$ gcc -c -I/opt/mqm/inc MYFORMAT.C $ gcc -o MYFORMAT -L/opt/mqm/lib \ -lmqm -shared MYFORMAT.o
For a multithreaded environment, you must build a second copy of the conversion exit. Use:
$ gcc -c -I/opt/mqm/inc MYFORMAT.C $ gcc -o MYFORMAT -L/opt/mqm/lib \ -lpthread -lmqm_r -shared MYFORMAT.o
$ cc -c -K PIC -I/opt/mqm/inc -lmproc -lext MYFORMAT.C $ ld -G MYFORMAT.O -o MYFORMAT $ cp MYFORMAT /opt/mqm/lib
$ cc -c -K PIC -I/opt/mqm/inc -liconv -lmproc -lext MYFORMAT.C $ ld -G MYFORMAT.O -o MYFORMAT $ cp MYFORMAT /opt/mqm/lib
If your application uses no threading calls or Posix V10 threading calls:
cc -c -KPIC -I/opt/mqm/inc MYFORMAT.C ld -G /opt/SUNWspro/SC4.0/lib/crt1.o \ /opt/SUNWspro/SC4.0/lib/crti.o \ /opt/SUNWspro/SC4.0/lib/crtn.o \ /opt/SUNWspro/SC4.0/lib/values-xt.o \ MYFORMAT.o -o MYFORMAT -lmqm -lthread -lsocket -lc -lnsl -ldl cp MYFORMAT /var/mqm/exits
If your application requires DCE threading (for example, if it is a CICS application):
cc -c -KPIC -I/opt/mqm/inc MYFORMAT.C ld -G /opt/SUNWspro/SC4.0/lib/crt1.o \ /opt/SUNWspro/SC4.0/lib/crti.o \ /opt/SUNWspro/SC4.0/lib/crtn.o \ /opt/SUNWspro/SC4.0/lib/values-xt.o \ MYFORMAT.o -o MYFORMAT_d -ldce -lnsl -lthread -lm -lsocket \ -lmqmcs_d -lmqm -lc -ldl cp MYFORMAT /var/mqm/exits
If you want to run applications using both the Posix V10-threaded and the DCE-threaded variants on a single queue manager:
Two object files are generated; one of which loads the MYFORMAT data-conversion exit, and the other of which loads the MYFORMAT_d data-conversion exit.