Writing a data-conversion exit program for IBM MQ for z/OS
Information about steps to consider when writing data-conversion exit programs for IBM MQ for z/OS .
Follow these steps:
- Take the supplied source skeleton CSQ4BAX9 (for non-CICS environments) or CSQ4CAX9 (for CICS ) as your starting point.
- Run the CSQUCVX utility.
- Follow the instructions in the prolog of CSQ4BAX9 or CSQ4CAX9 to incorporate the routines generated by the CSQUCVX utility, in the order that the structures occur in the message that we want to convert.
- The utility assumes that the data structures are not packed, that the implied alignment of the data is honored, and that the structures start on a fullword boundary, with bytes being skipped as required (as between ID and VERSION in the example in Valid syntax ). If the structures are packed, omit the CMQXCALA macros that are generated. Therefore, consider declaring your structures in such a way that all fields are named and no bytes are skipped; in the example in Valid syntax, add a field
MQBYTE DUMMY;between ID and VERSION.- The supplied exit returns an error if the input buffer is shorter than the message format to be converted. Although the exit converts as many complete fields as possible, the error causes an unconverted message to be returned to the application. To allow short input buffers to be converted as far as possible, including partial fields, change the TRUNC= value on the CSQXCDFA macro to YES: no error is returned, so the application receives a converted message. The application must handle the truncation.
- Add any other special processing code that we need.
- Rename the program to your data format name.
- Compile and link-edit your program like a batch application program (unless it is for use with CICS applications). The macros in the code generated by the utility are in the library, thlqual.SCSQMACS.
If the message contains character data, the generated code calls MQXCNVC. If your exit uses this call, link-edit it with the exit stub program CSQASTUB. The stub is language-independent and environment-independent. Alternatively, we can load the stub dynamically using the dynamic call name CSQXCNVC. See Dynamically calling the IBM MQ stub for more information.
Place the link-edited module in the application load library, and in a data set that is referenced by the CSQXLIB DD statement of our task procedure started by your channel initiator.
- If the exit is for use by CICS applications, compile and link-edit it like a CICS application program, including CSQASTUB if required. Place it in your CICS application program library. Define the program to CICS in the typical way, specifying EXECKEY( CICS ) in the definition.
Note: Although the LE/370 runtime libraries are needed for running the CSQUCVX utility (see step 2 ), they are not needed for link-editing or running the data-conversion exit itself (see steps 8 and 9 ).
See Writing IMS bridge applications for information about data conversion within the IBM MQ - IMS bridge.
Parent topic: Writing data-conversion exits