WebSphere MQ: Application Programming Guide - IBM

Transcription

WebSphere MQ Application Programming GuideVersion 7.0SC34-6939-01

WebSphere MQ Application Programming GuideVersion 7.0SC34-6939-01

NoteBefore using this information and the product it supports, be sure to read the general information under notices at the backof this book.Second edition (January 2009)This edition of the book applies to the following products:v IBM WebSphere MQ, Version 7.0v IBM WebSphere MQ for z/OS, Version 7.0and to any subsequent releases and modifications until otherwise indicated in new editions. Copyright International Business Machines Corporation 1993, 2009.US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.

ContentsFigures . . . . . . . . . . . . . . viiRules for naming WebSphere MQ objects . . .Handling program errors . . . . . . . . . .Locally determined errors . . . . . . . .Using report messages for problem determinationRemotely determined errors . . . . . . . .Tables . . . . . . . . . . . . . . . ixChapter 1. Designing applications thatuse WebSphere MQ. . . . . . . . . . 1 Introduction to message queuing . . . . . . . 1What is message queuing? . . . . . . . . . 1What is a message? . . . . . . . . . . . 2What is a message queue? . . . . . . . . . 2What is a queue manager?. . . . . . . . . 3What is a cluster?. . . . . . . . . . . . 3What is a shared queue, a queue-sharing group,and intra-group queuing? . . . . . . . . . 4What is a WebSphere MQ client? . . . . . . 4What is publish/subscribe? . . . . . . . . 4Main features of message queuing . . . . . . 4Benefits of message queuing to the applicationdesigner and developer . . . . . . . . . . 7What can you do with WebSphere MQ products? 7Overview of application design . . . . . . . . 9Planning your design . . . . . . . . . . 9Using WebSphere MQ objects . . . . . . . 10Designing your messages . . . . . . . . . 11WebSphere MQ techniques . . . . . . . . 12Application programming . . . . . . . . 14Testing WebSphere MQ applications . . . . . 16WebSphere MQ messages. . . . . . . . . . 16Message descriptor . . . . . . . . . . . 17Types of message . . . . . . . . . . . 17Format of message control information andmessage data . . . . . . . . . . . . . 23Message priorities . . . . . . . . . . . 26Message properties . . . . . . . . . . . 26Selecting messages from queues . . . . . . 31Asynchronous consumption of WebSphere MQmessages . . . . . . . . . . . . . . 42Message groups . . . . . . . . . . . . 45Message persistence . . . . . . . . . . 46Messages that fail to be delivered . . . . . . 47Messages that are backed out . . . . . . . 47Reply-to queue and queue manager . . . . . 48Message context . . . . . . . . . . . . 48WebSphere MQ objects . . . . . . . . . . 50Queue managers . . . . . . . . . . . 51Queue-sharing groups . . . . . . . . . . 52Queues . . . . . . . . . . . . . . . 52Administrative topic objects . . . . . . . . 60Namelists . . . . . . . . . . . . . . 61Process definitions . . . . . . . . . . . 61Authentication information objects . . . . . 61Channels . . . . . . . . . . . . . . 61Storage classes . . . . . . . . . . . . 62Listeners . . . . . . . . . . . . . . 62Services . . . . . . . . . . . . . . 62 Copyright IBM Corp. 1993, 20096364656768Chapter 2. Writing a WebSphere MQapplication . . . . . . . . . . . . . 71 Introducing the Message Queue Interface . . . . 71What is in the MQI? . . . . . . . . . . 71Parameters common to all the calls . . . . . 80Specifying buffers . . . . . . . . . . . 81Programming language considerations . . . . 81z/OS batch considerations . . . . . . . . 89UNIX signal handling . . . . . . . . . . 90Connecting to and disconnecting from a queuemanager . . . . . . . . . . . . . . . 93Connecting to a queue manager using theMQCONN call . . . . . . . . . . . . 94Connecting to a queue manager using theMQCONNX call . . . . . . . . . . . . 96Disconnecting programs from a queue managerusing MQDISC . . . . . . . . . . . . 100Opening and closing objects . . . . . . . . 101Opening objects using the MQOPEN call . . . 102Creating dynamic queues . . . . . . . . 109Opening remote queues . . . . . . . . . 109Closing objects using the MQCLOSE call . . . 110Putting messages on a queue . . . . . . . . 111Putting messages on a local queue using theMQPUT call . . . . . . . . . . . . . 111Putting messages on a remote queue . . . . 117Setting properties of a message . . . . . . 117Controlling context information . . . . . . 118Putting one message on a queue using theMQPUT1 call . . . . . . . . . . . . 120Distribution lists . . . . . . . . . . . 121Some cases where the put calls fail . . . . . 126Getting messages from a queue . . . . . . . 127Getting messages from a queue using theMQGET call . . . . . . . . . . . . . 127The order in which messages are retrieved froma queue . . . . . . . . . . . . . . 133Getting a particular message . . . . . . . 140Improving performance of non-persistentmessages . . . . . . . . . . . . . . 142Type of index . . . . . . . . . . . . 144Handling messages greater than 4 MB long . . 145Waiting for messages . . . . . . . . . . 151Signaling . . . . . . . . . . . . . . 152Skipping backout . . . . . . . . . . . 154Application data conversion . . . . . . . 157Browsing messages on a queue . . . . . . 158Some cases where the MQGET call fails . . . 165Writing publisher applications . . . . . . . . 166iii

Example 1: Publisher to a fixed topic . . . .Example 2: Publisher to a variable topic . . .Writing subscriber applications . . . . . . .Example 1: MQ Publication consumer . . . .Example 2: Managed MQ subscriber . . . .Example 3: Unmanaged MQ subscriber. . . .Writing data-conversion exits . . . . . . . .Invoking the data-conversion exit . . . . .Writing a data-conversion exit program . . .Writing a data-conversion exit program forWebSphere MQ for i5/OS . . . . . . . .Writing a data-conversion exit program forWebSphere MQ for z/OS . . . . . . . .Writing a data-conversion exit for WebSphereMQ on UNIX systems . . . . . . . . .Writing a data-conversion exit for WebSphereMQ for Windows . . . . . . . . . . .Exit and switch load files on Windowsoperating systems . . . . . . . . . . .Inquiring about and setting object attributes . . .Inquiring about the attributes of an object . . .Some cases where the MQINQ call fails . . .Setting queue attributes . . . . . . . . .Committing and backing out units of work . . .Syncpoint considerations in WebSphere MQapplications . . . . . . . . . . . . .Syncpoints in WebSphere MQ for z/OSapplications . . . . . . . . . . . . .Syncpoints in CICS for i5/OS applications. . .Syncpoints in WebSphere MQ for Windows,WebSphere MQ for i5/OS, and WebSphere MQon UNIX systems . . . . . . . . . . .Interfaces to the i5/OS external syncpointmanager . . . . . . . . . . . . . .Starting WebSphere MQ applications using triggersWhat is triggering? . . . . . . . . . .Prerequisites for triggering . . . . . . . .Conditions for a trigger event . . . . . . .Controlling trigger events . . . . . . . .Designing an application that uses triggeredqueues . . . . . . . . . . . . . .Trigger monitors . . . . . . . . . . .Properties of trigger messages . . . . . . .When triggering does not work . . . . . .Using and writing API exits . . . . . . . .Introducing API exits . . . . . . . . . .Compiling API exits . . . . . . . . . .Reference information . . . . . . . . .Using and writing applications on WebSphere MQfor z/OS . . . . . . . . . . . . . . .Environment-dependent WebSphere MQ forz/OS functions . . . . . . . . . . . .Program debugging facilities . . . . . . .Syncpoint support . . . . . . . . . . .Recovery support . . . . . . . . . . .The WebSphere MQ for z/OS interface with theapplication environment. . . . . . . . .Writing z/OS UNIX System Servicesapplications . . . . . . . . . . . . .The API-crossing exit for z/OS . . . . . .WebSphere MQ Workflow . . . . . . . .ivWebSphere MQ: Application Programming GuideApplication programming with shared queuesUsing and writing WebSphere MQ-CICS bridgeapplications for z/OS. . . . . . . . . . .Distributed program link applications . . . .3270 applications . . . . . . . . . . .Information applicable to both DPL and 3270IMS and IMS Bridge applications on WebSphereMQ for z/OS . . . . . . . . . . . . .Writing IMS applications using WebSphere MQWriting WebSphere MQ-IMS bridge applicationsObject-oriented programming with WebSphere MQWhat is in the WebSphere MQ Object Model?Programming language considerations . . . 14214217220 70Chapter 3. Building a WebSphere MQapplication . . . . . . . . . . . . 371209216314 Building your application on AIX . . . . . .Preparing C programs . . . . . . . . .Preparing COBOL programs . . . . . . .Preparing CICS programs . . . . . . . .Building your application on HP-UX . . . . .Preparing C programs . . . . . . . . .Preparing COBOL programs . . . . . . .Preparing CICS programs . . . . . . . .Address Space models supported by WebSphereMQ for HP-UX on IA64 (IPF) . . . . . . .Building your application on Linux . . . . . .Preparing C programs . . . . . . . . .Preparing COBOL programs . . . . . . .Building your application on i5/OS . . . . . .Preparing C programs . . . . . . . . .Preparing COBOL programs . . . . . . .Preparing CICS programs . . . . . . . .Preparing RPG programs . . . . . . . .SQL programming considerations . . . . .i5/OS programming considerations . . . . .Building your application on Solaris. . . . . .Preparing C programs . . . . . . . . .Preparing COBOL programs . . . . . . .Preparing CICS programs . . . . . . . .Building your application on Windows systemsBuilding 64-bit applications on Windows . . .Preparing C programs . . . . . . . . .Preparing COBOL programs . . . . . . .Preparing Visual Basic programs . . . . . .SSPI security exit . . . . . . . . . . .Building your application on z/OS . . . . . .Preparing your program to run . . . . . .Dynamically calling the WebSphere MQ stubDebugging your programs . . . . . . . .Using lightweight directory access protocol serviceswith WebSphere MQ for Windows . . . . . .What is a directory service? . . . . . . .What is LDAP?. . . . . . . . . . . .Using LDAP with WebSphere MQ . . . . .LDAP sample program . . . . . . . . 417417417418419Chapter 4. Sample WebSphere MQprograms . . . . . . . . . . . . . 425Sample programs (all platforms except z/OS). 425

Features demonstrated in the sample programsPreparing and running the sample programsThe Publish/Subscribe sample programs . .The Put sample programs . . . . . . .The Distribution List sample program . . .The Browse sample programs . . . . . .The Browser sample program . . . . . .The Get sample programs . . . . . . .The Reference Message sample programs . .The Request sample programs. . . . . .The Inquire sample programs . . . . . .The Set sample programs . . . . . . .The Echo sample programs . . . . . . .The Data-Conversion sample program . . .The Triggering sample programs . . . . .The Asynchronous Put sample program . .Running the samples using remote queues .Database coordination samples . . . . .The CICS transaction sample . . . . . .TUXEDO samples . . . . . . . . . .Encina sample program . . . . . . . .Dead-letter queue handler sample . . . .The Connect sample program . . . . . .The API exit sample program . . . . . .Using the SSPI security exit on Windowssystems . . . . . . . . . . . . .Sample programs for WebSphere MQ for z/OS .Features demonstrated in the sampleapplications . . . . . . . . . . . .Preparing and running sample applications forthe batch environment . . . . . . . .Preparing sample applications for the TSOenvironment. . . . . . . . . . . .Preparing the sample applications for the CICSenvironment. . . . . . . . . . . .Preparing the sample application for the IMSenvironment. . . . . . . . . . . .The Put samples . . . . . . . . . .The Get samples . . . . . . . . . .The Browse sample . . . . . . . . .The Print Message sample . . . . . . .The Queue Attributes sample . . . . . .The Mail Manager sample . . . . . . .The Credit Check sample . . . . . . .The Message Handler sample . . . . . 64464471471483483484485 .Connecting to a queue manager . . . .Disconnecting from a queue manager . .Creating a dynamic queue . . . . . .Opening an existing queue . . . . . .Closing a queue . . . . . . . . .Putting a message using MQPUT. . . .Putting a message using MQPUT1 . . .Getting a message . . . . . . . . .Getting a message using the wait option .Getting a message using signaling . . .Inquiring about the attributes of an object .Setting the attributes of a queue . . . .559560560562563564565566568570572574Chapter 7. System/390assembler-language examples . . . . 577. 487Connecting to a queue manager . . .Disconnecting from a queue manager .Creating a dynamic queue . . . . .Opening an existing queue . . . . .Closing a queue . . . . . . . .Putting a message using MQPUT. . .Putting a message using MQPUT1 . .Getting a message . . . . . . . .Getting a message using the wait optionGetting a message using signaling . .Inquiring about and setting the attributesqueue . . . . . . . . . . . . 491Chapter 8. PL/I examples . . . . . . 593. 486. 486. 493. 495.498499501504506510512519533Chapter 5. C language examples . . . 539Connecting to a queue manager . . . .Disconnecting from a queue manager . .Creating a dynamic queue . . . . . .Opening an existing queue . . . . . .Closing a queue . . . . . . . . .Putting a message using MQPUT. . . .Putting a message using MQPUT1 . . .Getting a message . . . . . . . . .Getting a message using the wait option .Getting a message using signaling . . .Inquiring about the attributes of an object .Setting the attributes of a queue . . . .Retrieving status information with MQSTATChapter 6. COBOL examples . . . . . necting to a queue manager . . . .Disconnecting from a queue manager . .Creating a dynamic queue . . . . . .Opening an existing queue . . . . . .Closing a queue . . . . . . . . .Putting a message using MQPUT. . . .Putting a message using MQPUT1 . . .Getting a message . . . . . . . . .Getting a message using the wait option .Getting a message using signaling . . .Inquiring about the attributes of an object .Setting the attributes of a queue . . . .a. 97598599601602605606Chapter 9. WebSphere MQ datadefinition files . . . . . . . . . . . 609C language include files . . .Visual Basic module files . .COBOL copy files . . . . .System/390 assembler-languagePL/I include files . . . . . . . . . . .macros. . .610610610612612Chapter 10. Coding standards on 64bit platforms . . . . . . . . . . . . 613Preferred data types . . . .Standard data types . . . .32-bit UNIX applications .64-bit UNIX applications .Windows 64–bit applications.613613613613614Contentsv

Notices . . . . . . . . . . . . . . 617Index . . . . . . . . . . . . . . . 621viWebSphere MQ: Application Programming GuideSending your comments to IBM . . . 633

Figures1. 2.3.4.5.6.7.8.9.10.11.12.13.14.15.16. .34.35.36.37.38.39.Message queuing compared with traditionalcommunication. . . . . . . . . . . . 5Representation of a message . . . . . . . 16Selection using MQSUB call . . . . . . . 34Selection using MQOPEN call . . . . . . 35Standard Message Driven applicationconsuming from two queues . . . . . . . 44Single Threaded Message Driven applicationconsuming from two queues . . . . . . . 45Group of logical messages . . . . . . . 45Segmented messages . . . . . . . . . 46How distribution lists work . . . . . . . 122Opening a distribution list in C . . . . . 124Opening a distribution list in COBOL124Putting a message to a distribution list in C126Putting a message to a distribution list inCOBOL . . . . . . . . . . . . . 126Logical order on a queue . . . . . . . 134Physical order on a queue . . . . . . . 135Skipping backout usingMQGMO MARK SKIP BACKOUT . . . . 156Simple WebSphere MQ publisher to a fixedtopic. . . . . . . . . . . . . . . 167Sample output from first publisher example168Simple WebSphere MQ publisher to avariable topic. . . . . . . . . . . . 171Sample output from second publisherexample . . . . . . . . . . . . . 172Topic object associations . . . . . . . . 173MQ publication consumer. . . . . . . . 176Output from MQ publication consumer177Managed MQ subscriber - part 1: declarationsand parameter handling. . . . . . . . . 180Managed MQ subscriber - part 2: code body. 181Output from managed MQ subscriber182Unmanaged MQ subscriber - part 1:declarations. . . . . . . . . . . . . 188Unmanaged MQ subscriber - part 2:parameter handling. . . . . . . . . . 189Unmanaged MQ subscriber - part 3: codebody. . . . . . . . . . . . . . . 191Publish 130 to NYSE/IBM/PRICE . . . . 192Receive the retained publication . . . . . 192Resume subscription . . . . . . . . . 193Receive retained publication with newunmanaged non durable subscription . . . 193Overlapping subscriptions . . . . . . . 193Subscription topics cannot be changed194Sample JCL used to invoke the CSQUCVXutility . . . . . . . . . . . . . . 199Flow of application and trigger messages229Relationship of queues within triggering230Setting of key fields for many CICS userprograms in a unit of work viewed from theperspective of the bridge. . . . . . . . .56.57. 58.59.60.61.62.63.64.65.66.67. Copyright IBM Corp. 1993, 2009Setting of key fields: WebSphere MQ pseudo-conversational 3270 transactionviewed from the perspective of the bridgeprior to CICS TS 2.2 . . . . . . . . .Setting of key fields: WebSphere MQ conversational 3270 transaction viewed fromthe perspective of the bridge . . . . . .User program abends (only program in theunit of work) . . . . . . . . . . .Fragments of JCL to link-edit the objectmodule in the batch environment, usingsingle-phase commit . . . . . . . . .Fragments of JCL to link-edit the objectmodule in the batch environment, usingtwo-phase commit . . . . . . . . . .Fragments of JCL to link-edit the objectmodule in the CICS environment . . . . .Fragments of JCL to link-edit the objectmodule in the IMS environment . . . . .Dynamic linking using COBOL in the batchenvironment . . . . . . . . . . . .Dynamic linking using COBOL in the CICSenvironment . . . . . . . . . . . .Dynamic linking using COBOL in the IMSenvironment . . . . . . . . . . . .Dynamic linking using assembler language inthe batch environment . . . . . . . .Dynamic linking using assembler language inthe CICS environment . . . . . . . .Dynamic linking using assembler language inthe IMS environment . . . . . . . . .Dynamic linking using C language in thebatch environment . . . . . . . . . .Dynamic linking using C language in theCICS environment . . . . . . . . . .Dynamic linking using C language in the IMSenvironment . . . . . . . . . . . .Dynamic linking using PL/I in the batchenvironment . . . . . . . . . . . .Dynamic linking using PL/I in the IMSenvironment . . . . . . . . . . . .File system import . . . . . . . . . .Running the Reference Message samplesRequest and Inquire samples using triggeringSample i5/OS Client/Server (Echo) programflowchart . . . . . . . . . . . . .The database coordination samples . . . .Example of ubbstxcn.cfg file for WebSphereMQ for Windows . . . . . . . . . .Sample TUXEDO makefile for WebSphereMQ for Windows . . . . . . . . . .Example of ubbstxcn.cfg file for WebSphereMQ for Windows . . . . . . . . . .Sample TUXEDO makefile for WebSphereMQ for Windows . . . . . . . . . .How TUXEDO samples work 412412413413437446454457465478479480481482vii

68.69.70.71.72.viiiExample of a report from the Print Messagesample application . . . . . . . . . .Programs and panels for the TSO versions ofthe Mail Manager . . . . . . . . . .Programs and panels for the CICS version ofthe Mail Manager . . . . . . . . . .Example of a panel showing a list of waitingmessages . . . . . . . . . . . . .Example of a panel showing the contents of amessage . . . . . . . . . . . . .WebSphere MQ: Application Programming Guide73.50874.51551675.76.51777.518Immediate Inquiry panel for the Credit Checksample application . . . . . . . . . .Programs and queues for the Credit Checksample application (COBOL programs only) .Initial screen for Message Handler sampleMessage list screen for Message Handlersample . . . . . . . . . . . . . .Chosen message is displayed . . . . . .521523534534535

Tables 1.2.3.4.5.6.7.8.9.10. 11. 12. 13.14.15.16.17.18.19.20.21.22.23.24. 25.Boolean operator outcome when logic is AAND B . . . . . . . . . . . . . . 41Boolean operator outcome when logic is A ORB . . . . . . . . . . . . . . . . 41Boolean operator outcome when logic is NOTA . . . . . . . . . . . . . . . . 41The MQ CONNECT TYPE environmentvariable . . . . . . . . . . . . . . 99Resolving queue names when usingMQOPEN. . . . . . . . . . . . . 103How queue attributes and options of theMQOPEN call affect access to queues . . . 107Using message and correlation identifiers140Using the group identifier . . . . . . . 141MQGET options and read ahead . . . . . 143Point to point vs. publish/subscribeWebSphere MQ program pattern. . . . . . 166Point to point vs. subscribe WebSphere MQprogram patterns. . . . . . . . . . . 174Errors from MQSUB with different queuehandles and subscription combinations . . . 187Skeleton source files . . . . . . . . . 197MQXR BEFORE exit processing . . . . . 260Valid combinations of function identifiers andExitReasons . . . . . . . . . . . . 267API exit errors and appropriate actions totake . . . . . . . . . . . . . . . 298z/OS environmental features . . . . . . 302When to use a shared-initiation queue317Mapping WebSphere MQ messages to IMStransaction types . . . . . . . . . . 360Essential code for CICS applications (AIX)374Essential code for CICS applications (HP-UX) 382Example of CRTPGM in the nonthreadedenvironment . . . . . . . . . . . . 389Example of CRTPGM in the threadedenvironment . . . . . . . . . . . . 389Essential code for CICS applications (Solaris) 396Location of WebSphere MQ libraries . . . . 398 Copyright IBM Corp. 1993, 200926.27.28.29. 30. 31.32.33.34. 35. 36.37.38.39.40.41.42.43.44.45.46.47.Context initiators and their associated contextacceptors . . . . . . . . . . . . .Call names for dynamic linking . . . . .CICS adapter trace entries . . . . . . .WebSphere MQ on UNIX sample programsdemonstrating use of the MQI (C andCOBOL) . . . . . . . . . . . . .WebSphere MQ for Windows sampleprograms demonstrating use of the MQI (Cand COBOL) . . . . . . . . . . . .WebSphere MQ for Windows sampleprograms demonstrating use of the MQI(Visual Basic) . . . . . . . . . . .WebSphere MQ for i5/OS sample programsdemonstrating use of the MQI (C andCOBOL) . . . . . . . . . . . . .Where to find the samples for WebSphereMQ on UNIX systems . . . . . . . .Where to find the samples for WebSphereMQ for Windows . . . . . . . . . .Categories of legacy publish/subscribesample C programs . . . . . . . . .Source for the distributed queuing exitsamples . . . . . . . . . . . . .Source for the data conversion exit samples(assembler language only) . . . . . . .Batch Put and Get samples . . . . . . .Batch Browse sample . . . . . . . . .Batch Print Message sample (C languageonly) . . . . . . . . . . . . . .TSO Mail Manager sample . . . . . . .TSO Message Handler sample . . . . . .CICS Put and Get samples . . . . . . .CICS Queue Attributes sample . . . . . .CICS Mail Manager sample (COBOL only)CICS Credit Check sample . . . . . . .Source and JCL for the Credit Check IMSsample (C only) . . . . . . . . . . 94496496497497499ix

xWebSphere MQ: Application Programming Guide

Chapter 1. Designing applications that use WebSphere MQIntroduction to message queuingThe WebSphere MQ products enable programs to communicate with one anotheracross a network of unlike components (processors, operating systems, subsystems,and communication protocols) using a consistent application programminginterface.Applications designed and written using this interface are known as messagequeuing applications, because they use the messaging and queuing style:MessagingPrograms communicate by sending each other data in messages ratherthan calling each other directly.QueuingMessages are placed on queues in storage, allowing programs to runindependently of each other, at different speeds and times, in differentlocations, and without having a logical connection between them.This chapter introduces messaging and queuing concepts, under these headings:v “What is message tisisisisisaaaaamessage?” on page 2message queue?” on page 2queue manager?” on page 3cluster?” on page 3WebSphere MQ client?” on page 4v “Main features of message queuing” on page 4v “Benefits of message queuing to the application designer and developer” onpage 7v “What can you do with WebSphere MQ products?” on page 7What is message queuing?Message queuing has been used in data processing for many years. It is mostcommonly used today in electronic mail. Without queuing, sending an electronicmessage over long distances requires every node on the route to be available forforwarding messages, and the addressees to be logged on and conscious of the factthat you are trying to send them a message. In a queuing system, messages arestored at intermediate nodes until the system is ready to forward them. At theirfinal destination they are stored in an electronic mailbox until the addressee isready to read them.Even so, many complex business transactions are processed today withoutqueuing. In a large network, the system might be maintaining many thousands ofconnections in a ready-to-use state. If one part of the system suffers a problem,many parts of the system become unusable.You can think of message queuing as being electronic mail for programs. In amessage queuing environment, each program from the set that makes up anapplication suite is designed to perform a well-defined, self-contained function inresponse to a specific request. To communicate with another program, a program Copyright IBM Corp. 1993, 20091

must put a message on a predefined queue. The other program retrieves themessage from the queue, and processes the requests and information contained inthe message. So message queuing is a style of program-to-program communication.Queuing is the mechanism by which messages are held until an application isready to process them. Queuing allows you to:v Communicate between programs (which might each be running in differentenvironments) without having to write the communication code.v Select the order in which a program processes messages.v Balance loads on a system by arranging for more than one program to service aqueue when the number of messages exceeds a threshold.v Increase the availability of your applications by arranging for an alternativesystem to service the queues if your primary system is unavailable.What is a message?In message queuing, a message is a collection of data sent by one program andintended for another program.WebSphere MQ defines four types of message:DatagramRequestReplyReportA simple message for which no reply is expectedA message for which a reply is expectedA reply to a request messageA message that describes an event such as the occurrence of anerrorSee “Types of message” on page 17 for more information about these messagetypes.Message descriptorA WebSphere MQ message consists of control information and application data.The control information is defined in a message descriptor structure (MQMD) andcontains such things as:v The type of the messagev An identifier for the messagev The priority for delivery of the messageThe structure and content of the application data is determined by theparticipating programs, not by WebSphere MQ.Message channel agentA message channel agent moves messages from one queue manager to another.References are made to them in this book when dealing with report messages andyou will need to consider them when designing your application. See WebSphereMQ Intercommunications for more information.What is a message queue?A message queue, known simply as a queue, is a named destination to whichmessages can be sent. Messages accumulate on queues until they are retrieved byprograms that service those queues.2WebSphere MQ: Application Programming Guide

Queues reside in, and are managed by, a queue manager (see “What is a queuemanager?”). The physical nature of a queue depends on the operating system onwhich the queue manager is running. A queue can either be a volatile buffer areain the memory of a computer, or a data set on a permanent storage device (such asa disk). The physical management of queues is the responsibility of the queuemanager and is not made apparent to the participating application programs.Programs access queues only through the external services of the queue manager.They can open a queue, put messages on it, get messages from it, and close thequeue. They can also set, and inquire about, the attributes of queues.What is a queue manager?A queue manager is a system program that provides queuing services toapplications.It provides an application programming interface so that programs can putmessages on, and get messages from, queues. A queue manager providesadditional

Syncpoints in WebSphere MQ for z/OS applications .217 Syncpoints in CICS for i5/OS applications. . . 220 Syncpoints in WebSphere MQ for Windows, WebSphere MQ for i5/OS, and WebSphere MQ on UNIX systems .220 Interfaces to the i5/OS external syncpoint manager .224 Starting WebSphere MQ applications using triggers 226