+

Search Tips | Advanced Search

Preparing and running sample programs on IBM i

Before you run the sample programs on IBM i, we must first create a queue manager and also create the queues that we need. To run COBOL samples, you might need to do some additional preparation.


About this task

The source for the IBM MQ for IBM i sample programs is provided in library QMQMSAMP as members of QCSRC, QCLSRC, QCBLLESRC, and QRPGLESRC.

We can use your own queues when you run the samples, or we can run the sample program AMQSAMP4 to create some sample queues. The source for the AMQSAMP4 program is included in file QCLSRC in library QMQMSAMP. We can compile it by using the CRTCLPGM command.

To run the samples, either use the C executable versions, which are supplied in the library QMQM, or compile them in a similar way to any other IBM MQ application.


Procedure

  1. Create a queue manager and set up the default definitions. We must do this before we can run any of the sample programs. For more information about creating a queue manager, see Administer IBM MQ. For information about configuring a queue manager to securely accept incoming connection requests from applications that are running in client mode, see Configure a queue manager to accept client connections on Windows, UNIX and IBM i.
  2. To call one of the sample programs by using data from member PUT in file AMQSDATA of library QMQMSAMP, use a command like:
    CALL PGM(QMQM/AMQSPUT4) PARM('QMQMSAMP/AMQSDATA(PUT)')
    
    Note: For a compiled module to use the IFS file system, specify the option SYSIFCOPT(*IFSIO) on CRTCMOD, then the file name, passed as a parameter, must be specified in the following format:
    home/me/myfile
    
  3. To use the COBOL versions of the Inquire, Set, and Echo examples, change the process definitions before you run these samples. For the Inquire, Set, and Echo examples, the sample definitions trigger the C versions of these samples. If we want the COBOL versions, we must change the process definitions:

    • SYSTEM.SAMPLE.INQPROCESS
    • SYSTEM.SAMPLE.SETPROCESS
    • SYSTEM.SAMPLE.ECHOPROCESS

    On IBM i, we can use the CHGMQMPRC command (for details, see Change MQ Process (CHGMQMPRC) ), or edit and run the AMQSAMP4 command with the alternative definition.

  4. Run the sample programs. For more information on the parameters that each of the samples expects, see the descriptions of the individual samples.Note: For the COBOL sample programs, when you pass queue names as parameters, we must provide 48 characters, padding with blank characters if necessary. Anything other than 48 characters causes the program to fail with reason code 2085.

Parent topic: Preparing and running the sample programs


Related reference

Last updated: 2020-10-04