The Publish/Subscribe sample on z/OS
The Publish/Subscribe sample programs demonstrate the use of the publish and subscribe features in IBM® MQ.
There are also COBOL samples that run in the CICS® environment; see The CICS Asynchronous Consumption and Publish/Subscribe sample on z/OS.
Running the CSQ4BCP1 sample
This program is written in C; it publishes messages to a topic. Start one of the subscriber samples before running this program.
- The name of the target topic string (required).
- The name of the queue manager (optional).
- Open options (optional).
- Close options (optional).
If a queue manager is not specified, CSQ4BCP1 connects to the default queue manager. There is a sample JCL to run the program, it resides in CSQ4BCPP.
Message content is provided through standard input (SYSIN DD).
Running the CSQ4BCP2 sample
This program is written in C; it subscribes to a topic and prints the messages received.
- The name of the target topic string (required).
- The name of the queue manager (optional).
- MQSD subscription options (optional).
If a queue manager is not specified, CSQ4BCP2 connects to the default queue manager. There is a sample JCL to run the program, it resides in CSQ4BCPS.
Running the CSQ4BCP3 sample
This program is written in C; it subscribes to a topic using a user-specified destination queue and prints the messages received.
- The name of the target topic string (required).
- The name of the destination (required).
- The name of the queue manager (optional).
- MQSD subscription options (optional).
If a queue manager is not specified, CSQ4BCP3 connects to the default queue manager. There is a sample JCL to run the program, it resides in CSQ4BCPD.
Running the CSQ4BCP4 sample
This program is written in C; it subscribes and gets messages from a topic allowing the use of extended options on the MQSUB call, extending those available on the simpler MQSUB sample: CSQ4BCP2. In addition to the message payload, message properties for each message are received and displayed.
-t Topic string.-o Topic object name.Important: One of -t or -o, or both, is required-m Queue manager name(optional).-b Connection binding type(optional), where type can have any of the following values:- standard : MQCNO_STANDARD_BINDING , which is the default value
- shared: MQCNO_SHARED_BINDING
- fastpath: MQCNO_FASTPATH_BINDING
- isolated: MQCNO_ISOLATED_BINDING
-q Destination queue name(optional).-w Wait interval on MQGET in seconds(optional), where seconds can have any of the following values:- unlimited: MQWI_UNLIMITED
- none: No wait
- n: Wait interval in seconds
- No value specified: When no value is specified, the default is 30 seconds
-d Subscription name(optional). Creates or resumes named durable subscription.-k(optional). Keeps durable subscription on MQCLOSE.
If a queue manager is not specified, CSQ4BCP4 connects to the default queue manager. There is a sample JCL to run the program, it resides in CSQ4BCPE.
Running the CSQ4BVP1 sample
This program is written in COBOL, it publishes messages to a topic. Start one of the subscriber samples before running this program.
This program takes no parameters. SYSIN DD provides the input topic name, queue manager name, and message content.
If a queue manager is not specified, CSQ4BVP1 connects to the default queue manager. There is a sample JCL to run the program, it resides in CSQ4BVPP.
Running the CSQ4BVP2 sample
This program is written in COBOL, it subscribes to a topic and prints the messages received.
This program takes no parameters. SYSIN DD provides the input for topic name and queue manager name.
If a queue manager is not specified, CSQ4BVP1 connects to the default queue manager. There is a sample JCL to run the program, it resides in CSQ4BVPP.