Running Applications and RPG Sample Programs

You can run the provided RPG sample programs to send and receive messages using TIBCO EMS.

Compiled versions of the RPG sample programs are available in the library where the product was restored using RSTLICPGM. You may also compile the RPG sample programs such that they are created in a development library of your choice by following the instructions in Compiling and Binding RPG Sample Programs.

The ILE RPG sample programs are multi-threaded applications, and must be run from subsystems that are enabled for multi-threading.

Note: Ensure that you have set the following environment variable to enable multi-threaded jobs in Qshell:

ADDENVVAR ENVVAR(QIBM_MULTI_THREADED) VALUE(Y) LEVEL(*SYS)

The *SYS environment variable might also be set at the *JOB level.

You can execute these jobs with the following command examples:
  • Executing From Qshell
    system "CALL PGM(samplib/SXJRMP) PARM('-server' 'server:port'
    '-destination' 'my-dest' 'message')"
    The following are additional command examples show how to invoke the RPG samples from Qshell:
    • system "CALL PGM(samplib/SXJRMP) PARM('-server' 'server:port'
      '-destination' 'my-dest' 'message')"
    • system "CALL PGM(samplib/SXJRMC) PARM('-server' 'server:port'
      '-destination' 'my-dest' )"
    • system "CALL PGM(samplib/SXJRAMC) PARM('-server' 'server:port'
      '-destination' 'my-dest' )"
  • Submitting to Batch
    SBMJOB CMD(CALL PGM(samplib/SXJRMP) PARM('-server' 'server:port'
    '-destination' 'my-dest' 'message')) LOG(4 0 *SECLVL) ALWMLTTHD(*YES)
where:
samplib
The name of the library where the product was restored using RSTLICPGM, or the name of a development library you have used for compiling your versions of the sample programs.
server:port
The name of the server and port where EMS is configured and running. For example, tcp://glatona-dt:7222.
-destination
Either -queue or -topic. The destination must be the same for both consumer and producer.
my-dest
The name of the topic or queue that you want to use. This name must match the topic or queue name in the consumer and producer.
message
The message to send. The current RPG sample programs cannot be embedded blanks.

The RPG samples are logging their output to the QSYSPRT printer file. A second printer file, QPRINT, is created with output from the C API, tibemsMsg_Print(). When executing the samples in the batch, the printer files are spooled to your output queue.

When executing the samples interactively in the Qshell environment, the printer files display to your screen if the application ends correctly and the files are closed properly. Otherwise, the printer files are spooled.