Building C++ programs on z/OS Batch, RRS Batch and CICS

Build IBM® MQ C++ programs on z/OS® for the Batch, RRS batch or CICS® environments and run the sample programs.

You can write C++ programs for three of the environments that IBM MQ for z/OS supports:
  • Batch
  • RRS batch
  • CICS

Compile, prelink and link

Create an z/OS application by compiling, pre-linking, and link-editing your C++ source code.

IBM MQ C++ for z/OS is implemented as z/OS DLLs for the IBM C++ for z/OS language. Using DLLs, you concatenate the supplied definition sidedecks with the compiler output at pre-link time. This allows the linker to check your calls to the IBM MQ C++ member functions.

Note: There are three sets of sidedecks for each of the three environments.
To build an IBM MQ for z/OS C++ application, create and run JCL. Use the following procedure:
  1. If your application runs under CICS, use the CICS-supplied procedure to translate CICS commands in your program.
    In addition, for CICS applications you need to:
    1. Add the SCSQLOAD library to the DFHRPL concatenation.
    2. Define the CSQCAT1 CEDA group using the member IMQ4B100 in the SCSQPROC library.
    3. Install CSQCAT1.
  2. Compile the program to produce object code. The JCL for your compilation must include statements that make the product data definition files available to the compiler. The data definitions are supplied in the following IBM MQ for z/OS libraries:
    • thlqual.SCSQC370
    • thlqual.SCSQHPPS

    Be sure to specify the /cxx compiler option.

    Note: The name thlqual is the high level qualifier of the IBM MQ installation library on z/OS.
  3. Pre-link the object code created in step 2, including the following definition sidedecks, which are supplied in thlqual.SCSQDEFS:
    1. imqs23dm and imqb23dm for batch
    2. imqs23dr and imqb23dr for RRS batch
    3. imqs23dc and imqb23dc for CICS
    These are the corresponding DLLs.
    1. imqs23im and imqb23im for batch
    2. imqs23ir and imqb23ir for RRS batch
    3. imqs23ic and imqb23ic for CICS
  4. Link-edit the object code created in step 3, to produce a load module, and store it in your application load library.

To run batch or RRS batch programs, include the libraries thlqual.SCSQAUTH and thlqual.SCSQLOAD in the STEPLIB or JOBLIB data set concatenation.

To run a CICS program, first get your system administrator to define it to CICS as an IBM MQ program and transaction. You can then run it in the usual way.

Run the sample programs

The programs are described in C++ sample programs.

The sample applications are supplied in source form only. The files are:

Table 1. z/OS sample program files
Sample Source program (in library thlqual.SCSQCPPS) JCL (in library thlqual.SCSQPROC)
HELLO WORLD imqwrld imqwrldr
SPUT imqsput imqsputr
SGET imqsget imqsgetr

To run the samples, compile and link-edit them as with any C++ program (see Building C++ programs on z/OS Batch, RRS Batch and CICS ). Use the supplied JCL to construct and run a batch job. You must initially customize the JCL, by following the commentary included with it.