MQ Series Reference for Mainframe
December 25, 2017 | Author: minsarakanna | Category: N/A
Short Description
Download MQ Series Reference for Mainframe...
Description
INDIANZOMBIE.BLOGSPOT.COM
MQ Series Reference For z/OS Kannan (indianZombie)
Contents An Introduction to MQSeries Messaging and Queuing...................................................................................3 What is MQSeries?...........................................................................................................................................3 MQSeries Objects .........................................................................................................................................3 1.1 Queue Manager............................................................................................................................................................3 1.2 Queues..............................................................................................................................................................................4 1.3 Channels...........................................................................................................................................................................4 1.4 Messages..........................................................................................................................................................................4 1.5 Pic: Message Flow Between Applications........................................................................................................7 Frequently used APIs’ in Application Programs..............................................................................................7 1.6 Need for API:..................................................................................................................................................................7 API Commands sequence for Sending MQ Messages ....................................................................................8 API Command sequence for Receiving MQ Messages ................................................................................10 Sample COBOL code ....................................................................................................................................13 Sample JCL code ...........................................................................................................................................32 Reference .......................................................................................................................................................33 10.0
Reference........................................................................................Error: Reference source not found
An Introduction to MQSeries Messaging and Queuing IBM WebSphere MQSeries allows different applications to communicate asynchronously through queues across different operating systems, different processors, and different application systems. WebSphere MQSeries includes the Message Queue Interface (MQI), a common low-level programming application program interface (API). Applications use MQI to read and write messages to the queues.
What is MQSeries? A middleware product that implements a messaging and queuing framework. Middleware - an intermediate software component that bridges dissimilar computing environments. Messaging - programs communicate by sending data in messages rather than by calling each other directly. Queuing - messages are put on queues in storage, eliminating the need for programs to be logically connected. A messaging and queuing framework is inherently ASYNCHRONOUS!
MQSeries Objects 1.1
Queue Manager A queue manager is that part of an MQSeries product that provides the messaging and queuing services to application programs, through the Message Queue Interface (MQI) program calls. It controls access to queues and serves as transaction (sync point) coordinator for all queue operations.
Queue manager names must be unique!
1.2
Queues MQSeries defines four types of queues. A queue instance is fully qualified by its queue manager and queue name. Local Queue - an actual queue for which storage is allocated. Remote Queue - a definition of a queue on a different queue manager (acts somewhat like a pointer) Alias Queue - another name for a local or remote queue. Typically used to switch queue destinations without modifying program code Model Queue - a template whose properties are copied when creating a new dynamic local queue (“create queue xxx “like” queue yyy).
Some properties of local queues: • • • • •
1.3
Maximum Message Size Maximum Queue Depth High/Low Factors Enable/Disable Put or Get Persistent/Not Persistent
Channels
A channel provides a communication path between Queue Managers.
1.4
Messages
•
A message any arbitrary data that one program wants to send to another. This data is called the application data.
•
A message needs to include other information, such as its destination and possibly a return address. This type of data is called the message descriptor
There are four types of messages:
1. A request message is used by one program to ask another program for something (usually data). A request message needs a reply. 2. A reply message is used in response to a request message.
3. A one-way message, as you would expect, doesn’t need a reply, though it can carry data. 4. A report message is used when something unexpected occurs. For example, if the data in a reply message is not usable, the receiving program might issue a report message.
• •
Most useful report messages are generated by the Queue Manager. For example, Delivery confirmation. Messages can have a “time-to-live”, called Expiry. A message that has not been delivered before its expiration is removed (not given to an app)
•
What to do with undeliverable messages? Each queue manager can have a dead-letter queue.
•
Messages can be individually designated persistent or non-persistent (persistent messages are logged to enable recovery)
•
Message Correlator - select which message to get from queue
•
Message Priority - retrieve messages in different order of put
•
Segmented Messages - allows ending of VERY LARGE messages (> 100 MB)
•
A message can contain a “reply to” address (the name of a Queue Manager and Queue). This tells the receiving application where any response should be sent.
•
Messages are added and removed from queues in Units of Work
•
The smallest Unit of Work is one message.
•
Units of work are atomic.
•
When an app reads a message from a queue, a message “appears” to have been removed, but in fact, it is still in storage until the app “commits” the unit of work.
1.5
Pic: Message Flow Between Applications
Frequently used APIs’ in Application Programs (MQI – The MQSeries Programming Interface) • • • •
• • • • • • • •
1.6 • •
MQCONN MQDISC MQOPEN MQCLOSE MQPUT MQPUT1 MQGET MQBEGIN MQCMIT MQBACK MQINQ MQSET
– Connect to queue manager – Disconnect from queue manager – Open object – Close object – Put message – Put one message – Get message – Begin unit of work – Commit – Back out – Inquire about object attributes – Set object attributes
Need for API: The MQ Series client code that runs in the client machine processes the API calls and routes them to the machine defined in the environment variable. The application program can put many messages in the queue before it closes or gets disconnected.
COBOL MQ
API Commands sequence for Sending MQ Messages •
Step 1: The MQCONN call connects an application program to a queue manager. It provides a queue manager connection handle, which is used by the application on subsequent message queuing calls. Syntax : MQCONN (QMgrName, Hconn, CompCode, Reason) QMgrName (MQCHAR48) – input à Name of queue manager. Hconn (MQHCONN) – output à Connection handle. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
•
Step 2: The MQOPEN call establishes access to an object. Syntax : MQOPEN (Hconn, ObjDesc, Options, Hobj, CompCode, Reason) Hconn (MQHCONN) – output à Connection handle. ObjDesc (MQOD) – input/output à Object descriptor. Options (MQLONG) – input à Options that control the action of MQOPEN. Hobj (MQHOBJ) – output à Object handle. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
•
Step 3: The MQPUT call puts a message on a queue or distribution list. The queue or distribution list must already be open.
Syntax : MQPUT (Hconn, Hobj, MsgDesc, PutMsgOpts, BufferLength, Buffer, CompCode, Reason) Hconn (MQHCONN) – output à Connection handle. Hobj (MQHOBJ) – input à Object handle. MsgDesc (MQMD) – input/output à Message descriptor. PutMsgOpts (MQPMO) – input/output à Options that control the action of MQPUT. BufferLength (MQLONG) – input à Length of the message in Buffer. Buffer (MQBYTE×BufferLength) – input à Message data. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
•
Step 4: The MQCLOSE call relinquishes access to an object, and is the inverse of the MQOPEN call. Syntax : MQCLOSE (Hconn, Hobj, Options, CompCode, Reason) Hconn (MQHCONN) – output à Connection handle. Hobj (MQHOBJ) – input/output à Object handle. Options (MQLONG) – input à Options that control the action of MQCLOSE. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
•
Step 5: The MQDISC call breaks the connection between the queue manager and the application program, and is the inverse of the MQCONN or MQCONNX call. Syntax : MQDISC (Hconn, CompCode, Reason)
Hconn (MQHCONN) – output à Connection handle. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
API Command sequence for Receiving MQ Messages •
Step 1: The MQCONN call connects an application program to a queue manager. It provides a queue manager connection handle, which is used by the application on subsequent message queuing calls. Syntax : MQCONN (QMgrName, Hconn, CompCode, Reason) QMgrName (MQCHAR48) – input à Name of queue manager. Hconn (MQHCONN) – output à Connection handle. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
•
Step 2: The MQOPEN call establishes access to an object. Syntax : MQOPEN (Hconn, ObjDesc, Options, Hobj, CompCode, Reason) Hconn (MQHCONN) – output à Connection handle. ObjDesc (MQOD) – input/output à Object descriptor. Options (MQLONG) – input à Options that control the action of MQOPEN. Hobj (MQHOBJ) – output à Object handle. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
•
Step 3: The MQGET call retrieves a message from a local queue that has been opened using the MQOPEN call. Syntax : MQGET (Hconn, Hobj, MsgDesc, GetMsgOpts, BufferLength, Buffer, DataLength, CompCode, Reason) Hconn (MQHCONN) – output à Connection handle. Hobj (MQHOBJ) – input à Object handle. MsgDesc (MQMD) – input/output à Message descriptor. GetMsgOpts (MQGMO) – input/output à Options that control the action of MQGET. BufferLength (MQLONG) – input à Length of the message in Buffer. Buffer (MQBYTE×BufferLength) – input à Message data. CompCode (MQLONG) – output à Completion code.
•
Step 4: The MQCLOSE call relinquishes access to an object, and is the inverse of the MQOPEN call. Syntax : MQCLOSE (Hconn, Hobj, Options, CompCode, Reason) Hconn (MQHCONN) – output à Connection handle. Hobj (MQHOBJ) – input/output à Object handle. Options (MQLONG) – input à Options that control the action of MQCLOSE. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
•
Step 5: The MQDISC call breaks the connection between the queue manager and the application program, and is the inverse of the MQCONN or MQCONNX call. Syntax : MQDISC (Hconn, CompCode, Reason) Hconn (MQHCONN) – output à Connection handle. CompCode (MQLONG) – output à Completion code. Reason (MQLONG) – output à Reason code qualifying CompCode.
Note: CICS programs do not have to issue MQCONN and MQDISC commands. The programs are connected automatically to the queue manager to which the CICS system is connected.
Sample COBOL code 1.1.1
MQPUT
IDENTIFICATION DIVISION. PROGRAM-ID. MQPUTPGM. AUTHOR. INDIANZOMBIE. DATE-WRITTEN. 19/07/2009. *----------------------------------------------------------------* * ENVIRONMENT DIVISION ** *----------------------------------------------------------------* ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM. OBJECT-COMPUTER. IBM. DATA DIVISION. ***------------------------------------------------------------*** * MQPUTPGM WORKING STORAGE BEGINS HERE ** ***------------------------------------------------------------*** WORKING-STORAGE SECTION. 01 WS-ABEND-VARS. 10 WS-ILBOABN0-RTN PIC X(08) VALUE 'ILBOABN0'. 10 WS-ABND-PGM PIC X(08) VALUE 'MQPUTPGM'. 10 WS-ABND-PARA PIC X(30) VALUE SPACES. 10 WS-ABND-MSG PIC X(60) VALUE SPACES. 10 WS-ABEND-CODE PIC S9(04) COMP VALUE ZEROES. 01 WS-VARIABLES. 05 WS-QMESG PIC X(100) VALUE SPACES. 01 W00-LOOP PIC S9(09) BINARY VALUE 0. 01 W00-NUMPUTS PIC S9(09) BINARY VALUE 0. 01 W00-ERROR-MESSAGE PIC X(48) VALUE SPACES. 01 W00-QMGR PIC X(10) VALUE 'MQA1'. 01 W00-QNAME PIC X(48) VALUE 'TCH.TRAINING.LOCAL1'. 01 W00-MSGBUFFER PIC X(5000) VALUE SPACES. 01 W00-PERS-NOPERS PIC X(01) VALUE 'P'. 88 PERSISTENT VALUE 'P'. 88 NOT-PERSISTENT VALUE 'N'. 01 W03-HCONN PIC S9(09) BINARY VALUE 0. 01 W03-HOBJ PIC S9(09) BINARY VALUE 0. 01 W03-OPENOPTIONS PIC S9(09) BINARY. 01 W03-COMPCODE PIC S9(09) BINARY. 01 W03-REASON PIC S9(09) BINARY. 01 PARM-LEN PIC 9(4) VALUE 0. 01 MQM-OBJECT-DESCRIPTOR. COPY MQCOPY2. 01 MQM-MESSAGE-DESCRIPTOR.
COPY MQCOPY1. 01 MQM-PUT-MESSAGE-OPTIONS. COPY MQCOPY3. 01 MQM-CONSTANTS. COPY MQCOPY4. ***------------------------------------------------------------*** PROCEDURE DIVISION. ***------------------------------------------------------------*** * MAIN PARA ** ***------------------------------------------------------------*** 1000-MAIN-PARA. PERFORM 1000-INITIALIZE-PARA THRU 1000-EXIT PERFORM 2000-PROCESS-PARA THRU 2000-EXIT PERFORM 3000-CLOSE-MQ-PARA THRU 3000-EXIT. 1000-MAIN-EXIT. STOP RUN. ***------------------------------------------------------------*** * INITIALIZE PARA ** ***------------------------------------------------------------*** 1000-INITIALIZE-PARA. *-------------------CONNECTING TO QUEUE--------------------------* DISPLAY '===========================================' DISPLAY ' QMGR - ', W00-QMGR DISPLAY ' QNAME - ', W00-QNAME DISPLAY '===========================================' CALL 'CSQBCONN' USING W00-QMGR W03-HCONN W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBCONN' TO W00-ERROR-MESSAGE MOVE '1000-INITIALIZE-PARA' TO WS-ABND-PARA MOVE 100 TO WS-ABEND-CODE MOVE 'CONNECTION FAILED TO QUEUE MANAGER' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT END-IF COMPUTE W03-OPENOPTIONS = MQOO-OUTPUT + MQOO-FAIL-IF-QUIESCING MOVE W00-QNAME TO MQOD-OBJECTNAME CALL 'CSQBOPEN' USING W03-HCONN MQOD W03-OPENOPTIONS W03-HOBJ W03-COMPCODE W03-REASON
IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBOPEN' TO W00-ERROR-MESSAGE MOVE '1000-INITIALIZE-PARA' TO WS-ABND-PARA MOVE 100 TO WS-ABEND-CODE MOVE 'OPEN OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT PERFORM 6666-MAIN-DISCONNECT THRU 6666-EXIT END-IF. 1000-EXIT. EXIT. ***------------------------------------------------------------*** * MAIN PROCESS PARA ** ***------------------------------------------------------------*** 2000-PROCESS-PARA. INITIALIZE W00-MSGBUFFER MOVE 'MY FIRST MESSAGE' TO W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT. INITIALIZE W00-MSGBUFFER MOVE 'MY SECOND MESSAGE' TO W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT. INITIALIZE W00-MSGBUFFER MOVE 'MY THIRD MESSAGE' TO W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT. INITIALIZE W00-MSGBUFFER MOVE 'MY FOURTH MESSAGE' TO W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT. 2000-EXIT. EXIT. ***------------------------------------------------------------*** * MQ PARA ** ***------------------------------------------------------------*** 2500-MQ-PARA. IF PERSISTENT THEN MOVE MQPER-PERSISTENT TO MQMD-PERSISTENCE ELSE MOVE MQPER-NOT-PERSISTENT TO MQMD-PERSISTENCE END-IF MOVE MQFMT-STRING TO MQMD-FORMAT MOVE MQPMO-FAIL-IF-QUIESCING TO MQPMO-OPTIONS MOVE MQMI-NONE TO MQMD-MSGID MOVE MQCI-NONE TO MQMD-CORRELID CALL 'CSQBPUT' USING W03-HCONN W03-HOBJ MQMD
MQPMO BY CONTENT LENGTH OF W00-MSGBUFFER BY REFERENCE W00-MSGBUFFER W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBPUT' TO W00-ERROR-MESSAGE MOVE '2500-MQ-PARA' TO WS-ABND-PARA MOVE 300 TO WS-ABEND-CODE MOVE 'PUT OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT ELSE ADD 1 TO W00-NUMPUTS END-IF. 2500-EXIT. EXIT. 3000-CLOSE-MQ-PARA. *------CLOSING MQ CALL 'CSQBCLOS' USING W03-HCONN W03-HOBJ MQCO-NONE W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBCLOS' TO W00-ERROR-MESSAGE MOVE '3000-CLOSE-PARA' TO WS-ABND-PARA MOVE 400 TO WS-ABEND-CODE MOVE 'CLOSE OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT ELSE PERFORM 6666-MAIN-DISCONNECT THRU 6666-EXIT END-IF DISPLAY '**************************************************' DISPLAY 'NUMBER OF MESSAGES PUT TO QUEUE:' W00-NUMPUTS DISPLAY '**************************************************'. 3000-EXIT. EXIT. ***------------------------------------------------------------** * MQ ERROR MESSAGE PARA * ***------------------------------------------------------------** 5555-DISPLAY-ERROR-MESSAGE. DISPLAY '**********************************************' DISPLAY '* ' W00-ERROR-MESSAGE DISPLAY '* COMPLETION CODE : ' W03-COMPCODE DISPLAY '* REASON CODE : ' W03-REASON
DISPLAY '**********************************************' PERFORM 9000-FILE-ABEND-PARA THRU 9000-EXIT. 5555-EXIT. EXIT. ***------------------------------------------------------------** * MQ MAIN DISCONNECT PARA * ***------------------------------------------------------------** 6666-MAIN-DISCONNECT. CALL 'CSQBDISC' USING W03-HCONN W03-COMPCODE W03-REASON. IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBDISC' TO W00-ERROR-MESSAGE MOVE '6666-MAIN-DISCONNECT' TO WS-ABND-PARA MOVE 600 TO WS-ABEND-CODE MOVE 'QUEUE MANAGER DICONNECT FAILURE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT END-IF. 6666-EXIT. EXIT. ***------------------------------------------------------------** * FILE ABEND PARA * ***------------------------------------------------------------** 9000-FILE-ABEND-PARA. MOVE WS-ABEND-CODE TO RETURN-CODE DISPLAY '**************************************************' DISPLAY ' ABEND SUMMARY ' DISPLAY '**************************************************' DISPLAY 'PROGRAM-NAME : ' WS-ABND-PGM DISPLAY 'ERROR-PARA : ' WS-ABND-PARA DISPLAY 'ERROR-MESSAGE : ' WS-ABND-MSG DISPLAY '**************************************************' CALL WS-ILBOABN0-RTN USING WS-ABEND-CODE. 9000-EXIT. EXIT.
1.1.2
MQGET
IDENTIFICATION DIVISION. PROGRAM-ID. MQGETPGM. AUTHOR. INDIANZOMBIE. DATE-WRITTEN. 19/07/2009. *----------------------------------------------------------------* * ENVIRONMENT DIVISION ** *----------------------------------------------------------------* ENVIRONMENT DIVISION.
CONFIGURATION SECTION. SOURCE-COMPUTER. IBM. OBJECT-COMPUTER. IBM. DATA DIVISION. ***------------------------------------------------------------*** * MQPUTPGM WORKING STORAGE BEGINS HERE ** ***------------------------------------------------------------*** WORKING-STORAGE SECTION. 01 WS-ABEND-VARS. 10 WS-ILBOABN0-RTN PIC X(08) VALUE 'ILBOABN0'. 10 WS-ABND-PGM PIC X(08) VALUE 'MQGETPGM'. 10 WS-ABND-PARA PIC X(30) VALUE SPACES. 10 WS-ABND-MSG PIC X(60) VALUE SPACES. 10 WS-ABEND-CODE PIC S9(04) COMP VALUE ZEROES. 01 WS-VARIABLES. 05 WS-QMESG PIC X(100) VALUE SPACES. 01 W00-LOOP PIC S9(09) BINARY VALUE 0. 01 W00-ERROR-MESSAGE PIC X(48) VALUE SPACES. 01 W00-QMGR PIC X(10) VALUE 'MQA1'. 01 W00-QNAME PIC X(48) VALUE 'TCH.TRAINING.LOCAL1'. 01 W00-MSGBUFFER PIC X(8000) VALUE SPACES. 01 W00-NUMGETS PIC S9(09) BINARY VALUE 0. 01 W00-MSGBUFLEN PIC S9(09) BINARY. 01 W00-DATALEN PIC S9(09) BINARY. 01 W00-PERS-NOPERS PIC X(01) VALUE 'P'. 88 PERSISTENT VALUE 'P'. 88 NOT-PERSISTENT VALUE 'N'. 01 W03-HCONN PIC S9(09) BINARY VALUE 0. 01 W03-HOBJ PIC S9(09) BINARY VALUE 0. 01 W03-OPENOPTIONS PIC S9(09) BINARY. 01 W03-COMPCODE PIC S9(09) BINARY. 01 W03-REASON PIC S9(09) BINARY. 01 PARM-LEN PIC 9(4) VALUE 0. 01 MQM-OBJECT-DESCRIPTOR. COPY MQCOPY2. 01 MQM-MESSAGE-DESCRIPTOR. COPY MQCOPY1. 01 MQM-GET-MESSAGE-OPTIONS. COPY CMQGMOV. 01 MQM-CONSTANTS. COPY MQCOPY4. ***------------------------------------------------------------*** PROCEDURE DIVISION. ***------------------------------------------------------------*** * MAIN PARA ** ***------------------------------------------------------------*** 1000-MAIN-PARA.
PERFORM 1000-INITIALIZE-PARA THRU 1000-EXIT PERFORM 2000-PROCESS-PARA THRU 2000-EXIT PERFORM 3000-CLOSE-MQ-PARA THRU 3000-EXIT. 1000-MAIN-EXIT. STOP RUN. ***------------------------------------------------------------*** * INITIALIZE PARA ** ***------------------------------------------------------------*** 1000-INITIALIZE-PARA. *-------------------CONNECTING TO QUEUE--------------------------* DISPLAY '===========================================' DISPLAY ' QMGR - ', W00-QMGR DISPLAY ' QNAME - ', W00-QNAME DISPLAY '===========================================' CALL 'CSQBCONN' USING W00-QMGR W03-HCONN W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBCONN' TO W00-ERROR-MESSAGE MOVE '1000-INITIALIZE-PARA' TO WS-ABND-PARA MOVE 100 TO WS-ABEND-CODE MOVE 'CONNECTION FAILED TO QUEUE MANAGER' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT END-IF COMPUTE W03-OPENOPTIONS = MQOO-INPUT-AS-Q-DEF + MQOO-FAIL-IF-QUIESCING MOVE W00-QNAME TO MQOD-OBJECTNAME CALL 'CSQBOPEN' USING W03-HCONN MQOD W03-OPENOPTIONS W03-HOBJ W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBOPEN' TO W00-ERROR-MESSAGE MOVE '1000-INITIALIZE-PARA' TO WS-ABND-PARA MOVE 100 TO WS-ABEND-CODE MOVE 'OPEN OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT PERFORM 6666-MAIN-DISCONNECT THRU 6666-EXIT END-IF.
1000-EXIT. EXIT. ***------------------------------------------------------------*** * MAIN PROCESS PARA ** ***------------------------------------------------------------*** 2000-PROCESS-PARA. INITIALIZE W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT DISPLAY 'FIRST MESSAGE:' W00-MSGBUFFER INITIALIZE W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT DISPLAY 'SECOND MESSAGE:' W00-MSGBUFFER INITIALIZE W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT DISPLAY 'THIRD MESSAGE:' W00-MSGBUFFER INITIALIZE W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT DISPLAY 'FOURTH MESSAGE:' W00-MSGBUFFER. 2000-EXIT. EXIT. ***------------------------------------------------------------*** * MQ PARA ** ***------------------------------------------------------------*** 2500-MQ-PARA. MOVE MQFMT-STRING TO MQMD-FORMAT COMPUTE MQGMO-OPTIONS= MQGMO-FAIL-IF-QUIESCING + MQGMO-ACCEPT-TRUNCATED-MSG MOVE MQMI-NONE TO MQMD-MSGID MOVE MQCI-NONE TO MQMD-CORRELID CALL 'CSQBGET' USING W03-HCONN W03-HOBJ MQMD MQGMO BY CONTENT LENGTH OF W00-MSGBUFFER BY REFERENCE W00-MSGBUFFER W00-DATALEN W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBPUT' TO W00-ERROR-MESSAGE MOVE '2500-MQ-PARA' TO WS-ABND-PARA MOVE 300 TO WS-ABEND-CODE MOVE 'GET OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT ELSE
ADD 1 END-IF.
TO W00-NUMGETS
2500-EXIT. EXIT. 3000-CLOSE-MQ-PARA. *------CLOSING MQ CALL 'CSQBCLOS' USING W03-HCONN W03-HOBJ MQCO-NONE W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBCLOS' TO W00-ERROR-MESSAGE MOVE '3000-CLOSE-PARA' TO WS-ABND-PARA MOVE 400 TO WS-ABEND-CODE MOVE 'CLOSE OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT ELSE PERFORM 6666-MAIN-DISCONNECT THRU 6666-EXIT END-IF DISPLAY '**************************************************' DISPLAY 'NUMBER OF MESSAGES GOT TO QUEUE:' W00-NUMGETS DISPLAY '**************************************************'. 3000-EXIT. EXIT. ***------------------------------------------------------------** * MQ ERROR MESSAGE PARA * ***------------------------------------------------------------** 5555-DISPLAY-ERROR-MESSAGE. DISPLAY '**********************************************' DISPLAY '* ' W00-ERROR-MESSAGE DISPLAY '* COMPLETION CODE : ' W03-COMPCODE DISPLAY '* REASON CODE : ' W03-REASON DISPLAY '**********************************************' PERFORM 9000-FILE-ABEND-PARA THRU 9000-EXIT. 5555-EXIT. EXIT. ***------------------------------------------------------------** * MQ MAIN DISCONNECT PARA * ***------------------------------------------------------------** 6666-MAIN-DISCONNECT. CALL 'CSQBDISC' USING W03-HCONN W03-COMPCODE W03-REASON. IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBDISC' TO W00-ERROR-MESSAGE
MOVE '6666-MAIN-DISCONNECT' TO WS-ABND-PARA MOVE 600 TO WS-ABEND-CODE MOVE 'QUEUE MANAGER DICONNECT FAILURE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT END-IF. 6666-EXIT. EXIT. ***------------------------------------------------------------** * FILE ABEND PARA * ***------------------------------------------------------------** 9000-FILE-ABEND-PARA. MOVE WS-ABEND-CODE TO RETURN-CODE DISPLAY '**************************************************' DISPLAY ' ABEND SUMMARY ' DISPLAY '**************************************************' DISPLAY 'PROGRAM-NAME : ' WS-ABND-PGM DISPLAY 'ERROR-PARA : ' WS-ABND-PARA DISPLAY 'ERROR-MESSAGE : ' WS-ABND-MSG DISPLAY '**************************************************' CALL WS-ILBOABN0-RTN USING WS-ABEND-CODE. 9000-EXIT. EXIT.
1.1.3
MQBROWSE
IDENTIFICATION DIVISION. PROGRAM-ID. MQBROWSE. AUTHOR. INDIANZOMBIE. DATE-WRITTEN. 19/07/2009. *---------------------------------------------------------------* ENVIRONMENT DIVISION * *---------------------------------------------------------------ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM. OBJECT-COMPUTER. IBM. DATA DIVISION. ***------------------------------------------------------------** * MQPUTPGM WORKING STORAGE BEGINS HERE ***------------------------------------------------------------** WORKING-STORAGE SECTION. 01 WS-ABEND-VARS. 10 WS-ILBOABN0-RTN PIC X(08) VALUE 'ILBOABN0'. 10 WS-ABND-PGM PIC X(08) VALUE 'MQGETPGM'.
*
10 WS-ABND-PARA 10 WS-ABND-MSG 10 WS-ABEND-CODE
PIC X(30) VALUE SPACES. PIC X(60) VALUE SPACES. PIC S9(04) COMP VALUE ZEROES.
01 WS-VARIABLES. 05 WS-QMESG PIC X(100) VALUE SPACES. 01 W00-LOOP PIC S9(09) BINARY VALUE 0. 01 W00-ERROR-MESSAGE PIC X(48) VALUE SPACES. 01 W00-QMGR PIC X(10) VALUE 'MQA1'. 01 W00-QNAME PIC X(48) VALUE 'TCH.TRAINING.LOCAL1'. 01 W00-MSGBUFFER PIC X(8000) VALUE SPACES. 01 W00-NUMGETS PIC S9(09) BINARY VALUE 0. 01 W00-MSGBUFLEN PIC S9(09) BINARY. 01 W00-DATALEN PIC S9(09) BINARY. 01 W00-PERS-NOPERS PIC X(01) VALUE 'P'. 88 PERSISTENT VALUE 'P'. 88 NOT-PERSISTENT VALUE 'N'. 01 W03-HCONN PIC S9(09) BINARY VALUE 0. 01 W03-HOBJ PIC S9(09) BINARY VALUE 0. 01 W03-OPENOPTIONS PIC S9(09) BINARY. 01 W03-COMPCODE PIC S9(09) BINARY. 01 W03-REASON PIC S9(09) BINARY. 01 PARM-LEN PIC 9(4) VALUE 0. 01 MQM-OBJECT-DESCRIPTOR. COPY CMQODV. 01 MQM-MESSAGE-DESCRIPTOR. COPY CMQMDV. 01 MQM-GET-MESSAGE-OPTIONS. COPY CMQGMOV. 01 MQM-CONSTANTS. COPY CMQV. ***------------------------------------------------------------** PROCEDURE DIVISION. ***------------------------------------------------------------** * MAIN PARA * ***------------------------------------------------------------** 1000-MAIN-PARA. PERFORM 1000-INITIALIZE-PARA THRU 1000-EXIT PERFORM 2000-PROCESS-PARA THRU 2000-EXIT PERFORM 3000-CLOSE-MQ-PARA THRU 3000-EXIT. 1000-MAIN-EXIT. STOP RUN. ***------------------------------------------------------------*** * INITIALIZE PARA ** ***------------------------------------------------------------*** 1000-INITIALIZE-PARA. *-------------------CONNECTING TO QUEUE--------------------------*
DISPLAY '===========================================' DISPLAY ' QMGR - ', W00-QMGR DISPLAY ' QNAME - ', W00-QNAME DISPLAY '===========================================' CALL 'CSQBCONN' USING W00-QMGR W03-HCONN W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBCONN' TO W00-ERROR-MESSAGE MOVE '1000-INITIALIZE-PARA' TO WS-ABND-PARA MOVE 100 TO WS-ABEND-CODE MOVE 'CONNECTION FAILED TO QUEUE MANAGER' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT END-IF COMPUTE W03-OPENOPTIONS = MQOO-BROWSE + MQOO-FAIL-IF-QUIESCING MOVE W00-QNAME TO MQOD-OBJECTNAME CALL 'CSQBOPEN' USING W03-HCONN MQOD W03-OPENOPTIONS W03-HOBJ W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBOPEN' TO W00-ERROR-MESSAGE MOVE '1000-INITIALIZE-PARA' TO WS-ABND-PARA MOVE 100 TO WS-ABEND-CODE MOVE 'OPEN OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT PERFORM 6666-MAIN-DISCONNECT THRU 6666-EXIT END-IF. 1000-EXIT. EXIT. ***------------------------------------------------------------*** * MAIN PROCESS PARA ** ***------------------------------------------------------------*** 2000-PROCESS-PARA. INITIALIZE W00-MSGBUFFER COMPUTE MQGMO-OPTIONS = MQGMO-FAIL-IF-QUIESCING + MQGMO-BROWSE-FIRST + MQGMO-ACCEPT-TRUNCATED-MSG PERFORM 2500-MQ-PARA THRU 2500-EXIT DISPLAY 'FIRST MESSAGE:' W00-MSGBUFFER
COMPUTE MQGMO-OPTIONS = MQGMO-OPTIONS MQGMO-BROWSE-FIRST + MQGMO-BROWSE-NEXT INITIALIZE W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT COMPUTE MQGMO-OPTIONS = MQGMO-OPTIONS MQGMO-BROWSE-NEXT + MQGMO-BROWSE-MSG-UNDER-CURSOR DISPLAY 'SECOND MESSAGE:' W00-MSGBUFFER INITIALIZE W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT COMPUTE MQGMO-OPTIONS = MQGMO-OPTIONS MQGMO-BROWSE-MSG-UNDER-CURSOR+ MQGMO-BROWSE-NEXT DISPLAY 'THIRD MESSAGE:' W00-MSGBUFFER INITIALIZE W00-MSGBUFFER PERFORM 2500-MQ-PARA THRU 2500-EXIT DISPLAY 'FOURTH MESSAGE:' W00-MSGBUFFER. 2000-EXIT. EXIT. ***------------------------------------------------------------*** * MQ PARA ** ***------------------------------------------------------------*** 2500-MQ-PARA. MOVE MQFMT-STRING TO MQMD-FORMAT MOVE MQMI-NONE TO MQMD-MSGID MOVE MQCI-NONE TO MQMD-CORRELID CALL 'CSQBGET' USING W03-HCONN W03-HOBJ MQMD MQGMO BY CONTENT LENGTH OF W00-MSGBUFFER BY REFERENCE W00-MSGBUFFER W00-DATALEN W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBPUT' TO W00-ERROR-MESSAGE MOVE '2500-MQ-PARA' TO WS-ABND-PARA MOVE 300 TO WS-ABEND-CODE MOVE 'GET OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT ELSE ADD 1 TO W00-NUMGETS END-IF.
2500-EXIT. EXIT. 3000-CLOSE-MQ-PARA. *------CLOSING MQ CALL 'CSQBCLOS' USING W03-HCONN W03-HOBJ MQCO-NONE W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBCLOS' TO W00-ERROR-MESSAGE MOVE '3000-CLOSE-PARA' TO WS-ABND-PARA MOVE 400 TO WS-ABEND-CODE MOVE 'CLOSE OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT ELSE PERFORM 6666-MAIN-DISCONNECT THRU 6666-EXIT END-IF DISPLAY '**************************************************' DISPLAY 'NUMBER OF MESSAGES GOT TO QUEUE:' W00-NUMGETS DISPLAY '**************************************************'. 3000-EXIT. EXIT. ***------------------------------------------------------------** * MQ ERROR MESSAGE PARA * ***------------------------------------------------------------** 5555-DISPLAY-ERROR-MESSAGE. DISPLAY '**********************************************' DISPLAY '* ' W00-ERROR-MESSAGE DISPLAY '* COMPLETION CODE : ' W03-COMPCODE DISPLAY '* REASON CODE : ' W03-REASON DISPLAY '**********************************************' PERFORM 9000-FILE-ABEND-PARA THRU 9000-EXIT. 5555-EXIT. EXIT. ***------------------------------------------------------------** * MQ MAIN DISCONNECT PARA * ***------------------------------------------------------------** 6666-MAIN-DISCONNECT. CALL 'CSQBDISC' USING W03-HCONN W03-COMPCODE W03-REASON. IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBDISC' TO W00-ERROR-MESSAGE MOVE '6666-MAIN-DISCONNECT' TO WS-ABND-PARA MOVE 600 TO WS-ABEND-CODE MOVE 'QUEUE MANAGER DICONNECT FAILURE'
TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT END-IF. 6666-EXIT. EXIT. ***------------------------------------------------------------** * FILE ABEND PARA * ***------------------------------------------------------------** 9000-FILE-ABEND-PARA. MOVE WS-ABEND-CODE TO RETURN-CODE DISPLAY '**************************************************' DISPLAY ' ABEND SUMMARY ' DISPLAY '**************************************************' DISPLAY 'PROGRAM-NAME : ' WS-ABND-PGM DISPLAY 'ERROR-PARA : ' WS-ABND-PARA DISPLAY 'ERROR-MESSAGE : ' WS-ABND-MSG DISPLAY '**************************************************' CALL WS-ILBOABN0-RTN USING WS-ABEND-CODE. 9000-EXIT. EXIT.
1.1.4
MQINQ
IDENTIFICATION DIVISION. PROGRAM-ID. MQPUTPGM. AUTHOR. INDIANZOMBIE. DATE-WRITTEN. 19/07/2009. *----------------------------------------------------------------* * ENVIRONMENT DIVISION ** *----------------------------------------------------------------* ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM. OBJECT-COMPUTER. IBM. DATA DIVISION. ***------------------------------------------------------------*** * MQPUTPGM WORKING STORAGE BEGINS HERE ***------------------------------------------------------------*** WORKING-STORAGE SECTION. 01 WS-ABEND-VARS. 10 WS-ILBOABN0-RTN PIC X(08) VALUE 'ILBOABN0'. 10 WS-ABND-PGM PIC X(08) VALUE 'MQPUTPGM'. 10 WS-ABND-PARA PIC X(30) VALUE SPACES. 10 WS-ABND-MSG PIC X(60) VALUE SPACES. 10 WS-ABEND-CODE PIC S9(04) COMP
**
VALUE ZEROES. 01 WS-VARIABLES. 05 WS-QMESG PIC X(100) VALUE SPACES. 01 W00-LOOP PIC S9(09) BINARY VALUE 0. 01 W00-NUMPUTS PIC S9(09) BINARY VALUE 0. 01 W00-ERROR-MESSAGE PIC X(48) VALUE SPACES. 01 W00-SELECTOR-COUNT PIC S9(09) BINARY. 01 W00-SELECTORS-TABLE. 02 W00-SELECTORS PIC S9(9) BINARY OCCURS 3 TIMES. 01 W00-INTATTRCOUNT PIC S9(9) BINARY. 01 W00-INTATTRS-TABLE. 02 W00-INTATTRS PIC S9(9) BINARY OCCURS 3 TIMES. 01 W00-CHARATTRLENGTH PIC S9(9) BINARY. 01 W00-CHARATTRS PIC X(500). 01 W00-QMGR PIC X(10) VALUE 'MQA1'. 01 W00-QNAME PIC X(48) VALUE 'TCH.TRAINING.LOCAL1'. 01 W00-MSGBUFFER PIC X(8000) VALUE SPACES. 01 W00-PERS-NOPERS PIC X(01) VALUE 'P'. 88 PERSISTENT VALUE 'P'. 88 NOT-PERSISTENT VALUE 'N'. 01 W03-HCONN PIC S9(09) BINARY VALUE 0. 01 W03-HOBJ PIC S9(09) BINARY VALUE 0. 01 W03-OPENOPTIONS PIC S9(09) BINARY. 01 W03-COMPCODE PIC S9(09) BINARY. 01 W03-REASON PIC S9(09) BINARY. 01 PARM-LEN PIC 9(4) VALUE 0. 01 MQM-OBJECT-DESCRIPTOR. COPY MQCOPY2. 01 MQM-MESSAGE-DESCRIPTOR. COPY MQCOPY1. 01 MQM-PUT-MESSAGE-OPTIONS. COPY MQCOPY3. 01 MQM-CONSTANTS. COPY MQCOPY4. ***------------------------------------------------------------*** PROCEDURE DIVISION. ***------------------------------------------------------------*** * MAIN PARA ** ***------------------------------------------------------------*** 1000-MAIN-PARA. PERFORM 1000-INITIALIZE-PARA THRU 1000-EXIT PERFORM 2000-PROCESS-PARA THRU 2000-EXIT PERFORM 3000-CLOSE-MQ-PARA THRU 3000-EXIT. 1000-MAIN-EXIT. STOP RUN. ***------------------------------------------------------------*** * INITIALIZE PARA **
***------------------------------------------------------------*** 1000-INITIALIZE-PARA. *-------------------CONNECTING TO QUEUE--------------------------* DISPLAY '===========================================' DISPLAY ' QMGR - ', W00-QMGR DISPLAY ' QNAME - ', W00-QNAME DISPLAY '===========================================' MOVE MQCA-Q-NAME TO W00-SELECTORS(1) MOVE MQCA-CREATION-DATE TO W00-SELECTORS(2) MOVE MQIA-CURRENT-Q-DEPTH TO W00-SELECTORS(3) MOVE 3 TO W00-SELECTOR-COUNT MOVE 3 TO W00-INTATTRCOUNT MOVE 500 TO W00-CHARATTRLENGTH CALL 'CSQBCONN' USING W00-QMGR W03-HCONN W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBCONN' TO W00-ERROR-MESSAGE MOVE '1000-INITIALIZE-PARA' TO WS-ABND-PARA MOVE 100 TO WS-ABEND-CODE MOVE 'CONNECTION FAILED TO QUEUE MANAGER' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT END-IF COMPUTE W03-OPENOPTIONS = MQOO-INQUIRE + MQOO-FAIL-IF-QUIESCING MOVE W00-QNAME TO MQOD-OBJECTNAME CALL 'CSQBOPEN' USING W03-HCONN MQOD W03-OPENOPTIONS W03-HOBJ W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBOPEN' TO W00-ERROR-MESSAGE MOVE '1000-INITIALIZE-PARA' TO WS-ABND-PARA MOVE 100 TO WS-ABEND-CODE MOVE 'OPEN OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT PERFORM 6666-MAIN-DISCONNECT THRU 6666-EXIT END-IF. 1000-EXIT. EXIT. ***------------------------------------------------------------*** * MAIN PROCESS PARA **
***------------------------------------------------------------*** 2000-PROCESS-PARA. PERFORM 2500-MQ-PARA THRU 2500-EXIT. 2000-EXIT. EXIT. ***------------------------------------------------------------*** * MQ PARA ** ***------------------------------------------------------------*** 2500-MQ-PARA. CALL 'CSQBINQ' USING W03-HCONN W03-HOBJ W00-SELECTOR-COUNT W00-SELECTORS-TABLE W00-INTATTRCOUNT W00-INTATTRS-TABLE W00-CHARATTRLENGTH W00-CHARATTRS W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBINQ' TO W00-ERROR-MESSAGE MOVE '2500-MQ-PARA' TO WS-ABND-PARA MOVE 300 TO WS-ABEND-CODE MOVE 'PUT OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT ELSE ADD 1 TO W00-NUMPUTS DISPLAY 'INTARRY1:' W00-INTATTRS(1) DISPLAY 'INTARRAY2:' W00-INTATTRS(2) DISPLAY 'W00-CHARATTRS:' W00-CHARATTRS END-IF. 2500-EXIT. EXIT. 3000-CLOSE-MQ-PARA. *------CLOSING MQ CALL 'CSQBCLOS' USING W03-HCONN W03-HOBJ MQCO-NONE W03-COMPCODE W03-REASON IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBCLOS' TO W00-ERROR-MESSAGE MOVE '3000-CLOSE-PARA' TO WS-ABND-PARA MOVE 400 TO WS-ABEND-CODE MOVE 'CLOSE OPERATION FAILED FOR QUEUE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE
THRU 5555-EXIT ELSE PERFORM 6666-MAIN-DISCONNECT THRU 6666-EXIT END-IF DISPLAY '**************************************************' DISPLAY 'NUMBER OF MESSAGES PUT TO QUEUE:' W00-NUMPUTS DISPLAY '**************************************************'. 3000-EXIT. EXIT. ***------------------------------------------------------------** * MQ ERROR MESSAGE PARA * ***------------------------------------------------------------** 5555-DISPLAY-ERROR-MESSAGE. DISPLAY '**********************************************' DISPLAY '* ' W00-ERROR-MESSAGE DISPLAY '* COMPLETION CODE : ' W03-COMPCODE DISPLAY '* REASON CODE : ' W03-REASON DISPLAY '**********************************************' PERFORM 9000-FILE-ABEND-PARA THRU 9000-EXIT. 5555-EXIT. EXIT. ***------------------------------------------------------------** * MQ MAIN DISCONNECT PARA * ***------------------------------------------------------------** 6666-MAIN-DISCONNECT. CALL 'CSQBDISC' USING W03-HCONN W03-COMPCODE W03-REASON. IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CSQBDISC' TO W00-ERROR-MESSAGE MOVE '6666-MAIN-DISCONNECT' TO WS-ABND-PARA MOVE 600 TO WS-ABEND-CODE MOVE 'QUEUE MANAGER DICONNECT FAILURE' TO WS-ABND-MSG PERFORM 5555-DISPLAY-ERROR-MESSAGE THRU 5555-EXIT END-IF. 6666-EXIT. EXIT. ***------------------------------------------------------------** * FILE ABEND PARA * ***------------------------------------------------------------** 9000-FILE-ABEND-PARA. MOVE WS-ABEND-CODE TO RETURN-CODE DISPLAY '**************************************************' DISPLAY ' ABEND SUMMARY ' DISPLAY '**************************************************' DISPLAY 'PROGRAM-NAME : ' WS-ABND-PGM DISPLAY 'ERROR-PARA : ' WS-ABND-PARA
DISPLAY 'ERROR-MESSAGE : ' WS-ABND-MSG DISPLAY '**************************************************' CALL WS-ILBOABN0-RTN USING WS-ABEND-CODE. 9000-EXIT. EXIT.
Sample JCL code 1.1.5
Compile JCL
//IBMUSER$ JOB (ACCT#),'MQBATTRI',CLASS=B,NOTIFY=&SYSUID,USER=&SYSUID //MQPROC PROC //* JCL TO COMPILE MQSERIES BATCH PROGRAM //COB EXEC PGM=IGYCRCTL,PARM=(LIB,SOURCE,MAP,XREF,LIST,TEST) //*STEPLIB DD DSN=IGY.SIGYCOMP,DISP=SHR //*SYSIN DD DSN=&OPTFILE,DISP=SHR //SYSIN DD DSN=&SRCLIB(&MEM),DISP=SHR //SYSLIB DD DSN=TCHN300.SAMPLE.MQCOPY,DISP=SHR //* DD DSN=IBMUSER.MIPS.SOURCE.FINAL,DISP=SHR //SYSLIN DD DSN=&&OBJLIB,DISP=(MOD,PASS), // SPACE=(TRK,(3,3)) //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) //SYSUT2 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) //SYSUT3 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) //SYSUT4 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) //SYSUT5 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) //SYSUT6 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) //SYSUT7 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1)) //* //* LINK EDIT STEP //LKED EXEC PGM=IEWL,PARM='XREF,LET', // COND=(4,LT,COB) //SYSLIB DD DSN=MQM.SCSQLOAD,DISP=SHR //* DD DSN=&LLIB1,DISP=SHR // DD DSN=CEE.SCEELKED,DISP=SHR // DD DSN=CEE.SCEERUN,DISP=SHR // DD DISP=SHR,DSN=ISP.SISPLOAD //SYSLIN DD DSN=&&OBJLIB,DISP=(OLD,DELETE) // DD DDNAME=SYSIN //SYSLMOD DD DSN=&LOADLIB(&MEM), // DISP=SHR //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSUT1 DD SPACE=(1024,(50,50)),UNIT=SYSDA // PEND
//MQLETTR EXEC MQPROC, // SRCLIB='TCHN300.SAMPLE.MQSRC', //* OBJLIB='IBMUSER.MQ.OBJLIB', // LOADLIB='TCHN300.SAMPLE.MQLOAD', //* OPTFILE='IBMUSER.MQ.UTIL.MISC(COMPOPTS)', // MEM=MQPUTPGM //LKED.SYSIN DD * INCLUDE SYSLIB(CSQBSTUB) /*
1.1.6
Run JCL
//IBMUSER$ JOB (ACCT#),'MQBATTRI',CLASS=B,NOTIFY=&SYSUID,USER=&SYSUID //PS010 EXEC PGM=MQPUTPGM //STEPLIB DD DSN=TCHN300.SAMPLE.MQLOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSTSPRT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //*
Reference 1) http://middleware.its.state.nc.us/middleware/Documentation/html/csqzak05/csqzak05tfrm.htm 2) www.indianzombie.blogspot.com
View more...
Comments