Running the samples
Use this information to learn how to configure the queue manager before running database coordination samples on C and COBOL.
Before you run the samples, configure the queue manager with the database product that we are using. For information about how to do this, see Scenario 1: Queue manager performs the coordination.
The following titles provide information about how to run samples in C and COBOL:
C samples
Messages must be in the following format to be read from a queue:
UPDATE Balance change=nnn WHERE Account=nnn
AMQSPUT can be used to put the messages on the queue.
The database coordination samples take two parameters:- Queue name (required)
- Queue manager name (optional)
Assuming that we have created and configured a queue manager for the single database sample called singDBQM, with a queue called singDBQ, you increment Mr Fred Bloggs's account by 50 as follows:
AMQSPUT singDBQ singDBQMThen key in the following message:
UPDATE Balance change=50 WHERE Account=1We can put multiple messages on the queue.
AMQSXAS0 singDBQ singDBQMThe updated status of Mr Fred Bloggs's account is then printed. Assuming that we have created and configured a queue manager for the multiple-database sample called multDBQM, with a queue called multDBQ, you decrement Ms Mary Brown's account by 75 as follows:
AMQSPUT multDBQ multDBQMThen key in the following message:
UPDATE Balance change=-75 WHERE Account=3We can put multiple messages on the queue.
AMQSXAG0 multDBQ multDBQMThe updated status of Ms Mary Brown's account is then printed.
COBOL samples
Messages must be in the following format to be read from a queue:
UPDATE Balance change=snnnnnnnn WHERE Account=nnnnnnnnFor simplicity, the Balance change must be a signed eight-character number and the Account must be an eight-character number.
The sample AMQSPUT can be used to put the messages on the queue.
The samples take no parameters and use the default queue manager. It can be configured to run only one of the samples at any time. Assuming that we have configured the default queue manager for the single database sample, with a queue called singDBQ, you increment Mr Fred Bloggs's account by 50 as follows:AMQSPUT singDBQThen key in the following message:
UPDATE Balance change=+00000050 WHERE Account=00000001We can put multiple messages on the queue:
AMQ0XAS0Type in the name of the queue:
singDBQThe updated status of Mr Fred Bloggs's account is then printed. Assuming that we have configured the default queue manager for the multiple database sample, with a queue called multDBQ, you decrement Ms Mary Brown's account by 75 as follows:
AMQSPUT multDBQThen key in the following message:
UPDATE Balance change=-00000075 WHERE Account=00000003We can put multiple messages on the queue:
AMQ0XAG0Type in the name of the queue:
multDBQThe updated status of Ms Mary Brown's account is then printed. Parent topic: Database coordination samples