Sie sind auf Seite 1von 64

IBML

MQSeries System Administration I for AS/400


(Course Code MQ16)

Student Exercises
ERC1.0

IBM Learning Services Worldwide Certified Material

Student Exercises

Publishing Information This publication has been produced using BookMaster (Program Number 5668-015), the Document Composition Facility (Program Number 5748-XX9), and Freelance 97 for Windows. It was printed on the IBM 3820 Page Printer.

May 2001 Edition The information contained in this document has not been submitted to any formal IBM test and is distributed on an as is basis without any warranty either express or implied. The use of this information or the implementation of any of these techniques is a customer responsibility and depends on the customers ability to evaluate and integrate them into the customers operational environment. While each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will result elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk. The original repository material for this course has been certified as being Year 2000 compliant.

Copyright International Business Machines Corporation 2001. All rights reserved.


This document may not be reproduced in whole or in part without the prior written permission of IBM. Note to U.S. Government Users Documentation related to restricted rights Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp.

Student Exercises

Trademarks IBM is a registered trademark of International Business Machines Corporation. The following are trademarks of International Business Machines Corporation in the United States, or other countries, or both: AD/Cycle AS/400 C/370 CICS/MVS CUA FFST IMS MQSeries MVS/SP OS/2 OS/390 RACF SAA System/370 VisualAge VTAM AIX BookManager C/400 COBOL/370 Current First Failure Support Technology IMS/ESA MVS/DFP MVS/XA OS/2 OS/400 RPG/400 SP2 System/390 VM/ESA WIN-OS/2 Application System/400 BookMaster CICS COBOL/400 DB2 IBM Integrated Language Environment MVS/ESA NetView OS/390 QMF RS/6000 SupportPac ThinkPad VSE/ESA

Lotus Notes and Notes are trademarks of Lotus Development Corporation in the United States, or other countries, or both. Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States and/or other countries. Microsoft, Windows, Windows NT and the Windows 95 logo are trademarks of Microsoft Corporation in the United States and/or other countries. SET is a trademark of SET Secure Electronic Transaction LLC in the United States and/or other countries. Intel and MCS are trademarks of Intel Corporation in the U.S. and/or other countries. Linux is a registered trademark of Linus Torvalds in the United States, or other countries, or both. UNIX is a registered trademark in the United States and/or other countries licensed exclusively through X/Open Company Limited. Other company, product, and service names may be trademarks or service marks of others.

Copyright IBM Corp. 2001


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

iii

Student Exercises

iv

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Contents
Exercise Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

vii

Exercises
Exercise 1. Working with Queues
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1-1 2-1 3-1 4-1 5-1 6-1

Exercise 2. Implementing Triggering Exercise 3. Recovery

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Exercise 4. Distributed Queueing

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Exercise 5. Queue Manager Clusters

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Exercise 6. MQSeries Client Implementation

. . . . . . . . . . . . . . . . . . . . . . . . . .

Copyright IBM Corp. 2001


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Contents

Student Exercises

vi

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise Description
Each exercise in this course is divided into sections as described below. Select the section that best fits your method of performing labs. You may elect to use a combination of these sections as appropriate. Exercise Instructions This section contains what it is you are to accomplish. There are no definitive details on how to perform the tasks. You are given the opportunity to work through the exercise given what you learned in the unit presentation, utilizing the unit Student Notebook, your past experience and maybe a little intuition. Exercise Instructions With Hints This section is an exact duplicate of the Exercise Instructions section except that in addition, specific details and/or hints are provided to help step you through the exercise. A combination of using the Instructions section along with Instructions With Hints section can make for a rewarding combination providing you with no hints when you don t want them and hints when you need them. Optional Exercise This section gives you additional exercises to perform relating to the unit of discussion. It is strictly optional and should be performed when you have completed the required exercises. The required exercises pertain to the most pertinent information provided in the unit. This section may help round out the hands-on experience for a related unit.

Copyright IBM Corp. 2001


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Exercise Description

vii

Student Exercises

viii

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise 1. Working with Queues

What This Exercise is About


The aim of this exercise is to start working with MQSeries commands and AS/400 Control Language (CL) commands.

What You Should Be Able to Do


At the end of the lab, you should be able to:

Create and start a queue manager. Use MQSeries commands and CL commands to create local queues and display attributes of MQSeries objects. Change queue attributes and create alias queues. Use sample programs to put messages on queues, browse messages and get messages from queues.

and, if time permits:

Clear and delete queues.

Introduction
This exercise can be done individually or in teams of two. First you are asked to create and start a queue manager with CL commands. Then you enter CL commands on a command line, and enter MQSeries commands into a source member, for use with the STRMQMMQSC command, to create and manager MQSeries objects, such as queues. To put, browse and get messages you use the supplied MQSeries sample programs. The following is a brief description of each of the programs you may need to use. These programs are CALLed from an AS/400 command line, and require two parameters. The first parameter is the name of the queue and the second is the name of the queue manager. Note: Both of these parameters are case sensitive, they must be 48 characters long and enclosed in quotation marks. If the names are less than 48 characters long, then they must be padded out with blanks. The source code for all the sample programs is provided in C, COBOL and RPG in source files in the QMQMSAMP library. No compiled programs are provided. The sample programs are
Copyright IBM Corp. 2001 Exercise 1. Working with Queues
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

1-1

Student Exercises

described in Appendix A of MQSeries for AS/400, Quick Beginnings V5.2, GC34-5557. The following instructions are based upon the assumption that the ILE RPG programs which use the prototype calls to the MQI are the ones that have been compiled and will be used in the labs. amq3put4 This program connects to the queue manager and opens the queue for output, reads three records from a compile-time array, generates a message for each line and puts the three messages onto the named queue. It then closes the queue, disconnects from the queue manager and ends. amq3gbr4 This program is CALLed in the same manner as amq3put4 and has the same parameter structure. The program connects to the queue manager, opens the queue for browsing, browses all the messages on the queue and writes them to QPRINT. It then closes the queue, disconnects from the queue manager and ends. amq3get4 This program is CALLed in the same manner as amq3gbr4 or amq3put4 and has the same parameter structure. The program connects to the queue manager, opens the queue for input, gets all the messages from the queue, writes the messages to QPRINT, closes the queue, disconnects from the queue manager and ends. NOTE: Following the execution of each of the above programs, you will need to view the reports, e.g. use the WRKSPLF command.

Required Materials

MQSeries for AS/400 V.5.1 installed on the system. The sample programs amq3put4, amq3gbr4, and amq3get4 are CALLable from any command line. A text editor such as Source Entry Utility (SEU).

1-2

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise Instructions
Step 1: Create and start a queue manager 1. Create a queue manager. Call it M##.QM1, where ## is your 2-digit team number. Use this queue manager for all the steps in this exercise. 2. Start the queue manager 3. Run the sample program AMQSAMP4 to create the MQM queues to use with the sample programs - i.e. SYSTEM.SAMPLE. Step 2: Use the AS/400 CL commands interactively 4. Use the CL commands to perform the following tasks: a. Display all the attributes of the queue manager. b. List the names of all the queues whose names begin with the characters SYSTEM. c. Create a local queue QL.A whose definition should include a text description. d. Display all the attributes of the queue. e. Change the maximum number of messages allowed on the queue to 1000. f. Again display the queue attributes. Was the modification successful and is the queue description unchanged? g. Define a second local queue QL.B with a text description. h. Display all the attributes of the queue. i. Change the maximum number of messages allowed on the queue to 2000. j. Display again the queue attributes of QL.B. Was the creation of the queue successful and is there a queue description?

Step 3: Use the MQSeries commands in a command file. 5. Use SEU to add a member, called E1_ST03, type TXT, to the file QMQSC in your library, MQ16## ,where ## is your two digit team number, 01 to 99. 6. Add MQSeries commands to this member to perform the same functions that you performed in Step 2, above. 7. Process this member and check the spool file to ensure that all the commands were executed successfully. If not, correct the commands in the source member, and reprocess it. Step 4: Use the sample programs

Copyright IBM Corp. 2001

Exercise 1. Working with Queues


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

1-3

Student Exercises

8. Put messages on the local queue QL.A, and remember the parm is 48 characters - i.e. include the correct number of blanks. 9. Work with MQSeries messages to verify messages were put on queue QL.A. 10. Work with spool files to display sample job AMQ3GBR4 output. 11. Get the messages from the queue to make the queue empty. 12. Work with spool files to display sample job AMQ3GET4 output.

Step 5: Work with Alias Queues (using either or both command approaches). 13. Create an alias queue QA.A which resolves to your local queue QL.A. 14. Inhibit put requests on the alias queue. 15. Change QL.B to inhibit put requests on your local queue QL.B. 16. Create an alias queue QA.B which resolves to your local queue QL.B. 17. Try to put messages on both alias and local queues using the sample program. 18. Work with MQSeries messages to verify messages were put on queues. End of Exercise

1-4

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Optional Exercise Instructions


Step 1: Working with queues 1. Put some messages on your queues QL.A and QL.B. 2. Show the CURDEPTH of all the queues you have created. 3. Define an new local queue QL.X with the attributes of QA.A. 4. Error? Now use the attributes of QL.A. 5. Put some messages on QL.X. 6. Change the description of QL.A. 7. Display the DESCR attribute of all your queues. 8. Any change? 9. Clear queue QL.A. 10. Clear queue QA.A. 11. Successful? Give the reason why. 12. Delete QL.X. 13. Successfully deleted? If not, modify the command. End of Optional Exercise

Copyright IBM Corp. 2001

Exercise 1. Working with Queues


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

1-5

Student Exercises

Exercise Instructions With Hints


Step 1: Create and start a queue manager 1. Create a queue manager. Call it M##.QM1, where ## is your 2-digit team number. Use this queue manager for all the steps in this exercise.

CRTMQM MQMNAME(M##.QM1) DFTQMGR(*NO)


2. Start the queue manager

STRMQM MQMNAME(M##.QM1)
(Because only one queue manager, can be the default you must remember to supply the queue manager name.) 3. Run the sample program AMQSAMP4 to create the MQM queues to use with the sample programs - i.e. SYSTEM.SAMPLE.

CALL PGM(AMQSAMP4) PARM(M##.QM1)


Step 2: Use the AS/400 CL commands interactively 4. Use the CL commands to perform the following tasks: a. Display all the attributes of the queue manager.

DSPMQM MQMNAME(M##.QM1)
b. List the names of all the queues whose names begin with the characters SYSTEM.

WRKMQMQ MQMNAME(M##.QM1) QNAME(SYSTEM*)


c. Create a local queue QL.A whose definition should include a text description.

CRTMQMQ QNAME(QL.A) QTYPE(*LCL) MQMNAME(M##.QM1)


TEXT(QL.A Text) d. Display all the attributes of the queue.

DSPMQMQ QNAME(QL.A) MQMNAME(M##.QM1)


e. Change the maximum number of messages allowed on the queue to 1000.

CHGMQMQ QNAME(QL.A) QTYPE(*LCL) MAXDEPTH(1000)


MQMNAME(M##.QM1) f. Again display the queue attributes. Was the modification successful and is the queue description unchanged?

DSPMQMQ QNAME(QL.A) MQMNAME(M##.QM1)


g. Define a second local queue QL.B with a text description.

CRTMQMQ QNAME(QL.B) QTYPE(*LCL) TEXT(QL.B Text)


MQMNAME(M##.QM1) or
Copyright IBM Corp. 2001

1-6

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Student Exercises

WRKMQMQ MQMNAME(M##.QM1) and F6=Create h. Display all the attributes of the queue.

DSPMQMQ QNAME(QL.B) MQMNAME(M##.QM1)


or WRKMQMQ MQMNAME(M##.QM1) and Option 5=Display i. Change the maximum number of messages allowed on the queue to 2000.

CHGMQMQ QNAME(QL.B) QTYPE(*LCL) MAXDEPTH(2000)


MQMNAME(M##.QM1) or WRKMQMQ MQMNAME(M##.QM1) and Option 2= Change j. Display again the queue attributes of QL.B. Was the creation of the queue successful and is there a queue description?

DSPMQMQ QNAME(QL.B) MQMNAME(M##.QM1)


or WRKMQMQ MQMNAME(M##.QM1) and Option 5=Display

Step 3: Use the MQSeries commands in a command file. 5. Use SEU to add a member, called E1_ST03, type TXT, to the file QMQSC in your library, MQ16## ,where ## is your two digit team number, 01 to 99. CRTSRCPF FILE(MQ16##/QMQSC) TEXT(MQSeries Source Code) MQ16##, is your personal library, where ## is your 2-digit team number.) STRSEU SRCFILE(MQ16##/QMQSC) SRCMBR(E1_ST03) TYPE(TXT) TEXT(MQSeries commands for Ex1, Step 3.) (You can also use STRPDM to create and view all members in your library) 6. Add MQSeries commands to this member to perform the same functions that you performed in Step 2, above.

DIS QMGR DIS Q(SYSTEM*) DEF QL(QL.A) DESCR(QL.A Text) REPLACE DIS QL(QL.A) ALTER QL(QL.A) MAXDEPTH(1000) DIS QL(QL.A) DEF QL(QL.B) DESCR(QL.B Text) REPLACE DEF QL(QL.B) MAXDEPTH(2000) REPLACE DIS QL(QL.B) 7. Process this member and check the spool file to ensure that all the commands were executed successfully. If not, correct the commands in the source member, and reprocess it.

Copyright IBM Corp. 2001

Exercise 1. Working with Queues


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

1-7

Student Exercises

STRMQMMQSC SRCMBR(E1_ST03) SRCFILE(MQ1601/QMQSC) MQMNAME(M##.QM1) OPTION(*VERIFY)

Step 4: Use the sample programs 8. Put messages on the local queue QL.A, and remember the parm is 48 characters - i.e. include the correct number of blanks.

CALL PGM(AMQ3PUT4)

PARM(QL.A M##.QM1)

9. Work with MQSeries messages to verify messages were put on queue QL.A.

WRKMQMMSG QNAME(QL.A) MQMNAME(M##.QM1) and Option


8=Display Data 10. Browse the messages on the queue.

CALL PGM(AMQ3GBR4)

PARM(QL.A M##.QM1)

11. Work with spool files to display sample job AMQ3GBR4 output. . WRKSPLF and Option 5=Display 12. Get the messages from the queue to make the queue empty.

CALL PGM(AMQ3GET4)

PARM(QL.A M##.QM1)

13. Work with spool files to display sample job AMQ3GET4 output. WRKSPLF and Option 5=Display

Step 5: Work with Alias Queues (using either or both command approaches). 14. Create an alias queue QA.A which resolves to your local queue QL.A.

CRTMQMQ QNAME(QA.A) QTYPE(*ALS) MQMNAME(M##.QM1)


TGTQNAME(QL.A) or WRKMQMQ MQMNAME(M##.QM1) F6=Create 15. Inhibit put requests on the alias queue.

CHGMQMQ QNAME(QA.A)
MQMNAME(M##.QM1) QTYPE(*ALS) PUTENBL(*NO) or WRKMQMQ MQMNAME(M##.QM1) Option 2=Change 16. Change QL.B to inhibit put requests on your local queue QL.B.

CHGMQMQ QNAME(QL.B)
MQMNAME(M##.QM1) QTYPE(*LCL) PUTENBL(*NO) or WRKMQMQ MQMNAME(M##.QM1) Option 2=Change 17. Create an alias queue QA.B which resolves to your local queue QL.B.
1-8 MQSeries Sys Admin I for AS/400
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

CRTMQMQ QNAME(QA.B) QTYPE(*ALS)


MQMNAME(M##.QM1) TGTQNAME(QL.B) or WRKMQMQ MQMNAME(M##.QM1) F6=Create 18. Try to put messages on both alias and local queues using the sample program.

CALL PGM(AMQ3PUT4)

PARM(QL.A M##.QM1)

19. Work with MQSeries messages to verify messages were put on queues.

WRKMQMMSG QNAME(QL.A) MQMNAME(M##.QM1)


and Option 8=Display Data Repeat this for queues QA.A, QL.B and QA.B. End of Exercise with Hints

Copyright IBM Corp. 2001

Exercise 1. Working with Queues


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

1-9

Student Exercises

Optional Exercise Instructions With Hints


Step 1: Working with queues 1. Put some messages on your queues QL.A and QL.B.

CALL PGM(AMQ3PUT4) PARM(QueueName QueueManagerName)


2. Show the CURDEPTH of all the queues you have created.

Create a source member QUEUES in QMQSC file containing the MQSeries


command: DISPLAY Q(Q*) CURDEPTH then run it with STRMQMMQSC SRCMBR(QUEUES) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF. 3. Define an new local queue QL.X with the attributes of QA.A.

Create a source member QLIKEQA.A in QMQSC file containing the


MQSeries command: DEFINE QLOCAL(QL.X) LIKE(QA.A) and then run it with STRMQMMQSC SRCMBR(QLIKEQA.A) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF. 4. Error? Now use the attributes of QL.A.

Create a source member QLIKEQL.A in QMQSC file containing the


MQSeries command: DEFINE QLOCAL(QL.X) LIKE(QL.A) and then run it with STRMQMMQSC SRCMBR(QLIKEQL.A) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF. 5. Put some messages on QL.X.

CALL PGM(AMQ3PUT4) PARM(QueueName QueueManagerName)


6. Change the description of QL.A.

Create a source member ALTERQL.A in QMQSC file containing the


MQSeries command: ALTER QL(QL.A) DESCR(QL.A Text new) and then run it with STRMQMMQSC SRCMBR(ALTERQL.A) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF. 7. Display the DESCR attribute of all your queues.

Create a source member DESCR in QMQSC file containing the MQSeries


command: DISPLAY Q(Q*) DESCR and then run it with STRMQMMQSC SRCMBR(DESCR) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF. 8. Any change? 9. Clear queue QL.A.

Create a source member CLEARQL.A in QMQSC file containing the


MQSeries command: CLEAR QL(QL.A) and then run it with STRMQMMQSC SRCMBR(CLEARQL.A) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF 10. Clear queue QA.A.

1-10

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Create a source member CLEARQA.A in QMQSC file containing the


MQSeries command: CLEAR QL(QA.A) and then run it with STRMQMMQSC SRCMBR(CLEARQA.A) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF. 11. Successful? Give the reason why. 12. Delete QL.X.

Create a source member DELETEQL.X in QMQSC file containing the


MQSeries command: DELETE QL(QL.X) and then run it with STRMQMMQSC SRCMBR(DELETEQL.X) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF. 13. Successfully deleted? If not, modify the command.

Create a source member PURGEQL.X in QMQSC file containing the


MQSeries command: DELETE QL(QL.X) PURGE and then run it with STRMQMMQSC SRCMBR(PURGEQL.X) MQMNAME(M##.QM1) and check the spool file using command WRKSPLF.

End of Optional Exercise with Hints

Copyright IBM Corp. 2001

Exercise 1. Working with Queues


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

1-11

Student Exercises

1-12

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise 2. Implementing Triggering

What This Exercise is About


The aim of this exercise is to extend your experience of using MQSeries by getting a simple application involving triggering to work. In addition, you will use a request-reply scenario to see how a reply-to queue can be used.

What You Should Be Able to Do


At the end of the lab, you should be able to:

Create the objects required for triggering. Start a trigger monitor. Use sample programs to test triggering.

and, if time permits:

Alter the process object and queue definitions to control triggering. Alter the process object to start applications asynchronously.

Introduction
This exercise is to use a sample program to put a request message on a queue which has been defined for triggering, and to see the triggered program return a reply.

Three more sample programs which you will use during this exercise are: amq3req4 the RPGLE version or amqsreq4 the C version. This program connects to the queue manager and opens a model queue which creates a temporary dynamic reply-to queue. It then reads three records from a compile-time array, generates a message for each line and puts the three messages onto the named queue which has been defined for triggering. Each message will have the name of the temporary dynamic queue in the reply-to queue name field of the message descriptor. The program then waits for the reply messages to arrive and then writes them to QPRINT, closes the queue, disconnects from the queue manager and ends.

Copyright IBM Corp. 2001

Exercise 2. Implementing Triggering


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

2-1

Student Exercises

NOTE: This program has three parameters. The first two are the same as before, namely the output queue name and the queue managers name. The third parameter is the name of a model queue to be used as the reply-to queue. If the third parameter is omitted then the program uses the name of the IBM-supplied default model queue, SYSTEM.SAMPLE.REPLY. All of the parameters are case sensitive, must be 48 characters long and enclosed in quotation marks. If the names are less than 48 characters long, then they must be padded out with blanks.

amq3ech4 the RPGLE version or amqsech4 the C version. This program is designed to be started by a trigger monitor and not from a command line. The program connects to the queue manager named in the structure passed to it by the trigger monitor and opens the queue which is also named in the structure. This is called the request queue in the description that follows. The program gets a message from the request queue, creates a new message containing the same application data as the original message, and puts the new message on the reply-to queue named in the message descriptor of the original message. The program then gets each ch of the remaining messages on the request queue in turn and generates a reply in the same way. When the request queue is empty, the program closes the queue and disconnects from the queue manager.

If time permits, you may also need the following sample program. amq3inq4 the RPGLE version or amqsinq4 the C version. This program is designed to be started by a trigger monitor in the same way as amq3ech4. The program connects to the queue manager, r, opens the request queue, gets a message from the queue, and interprets the application data as the name of a queue. The program opens this queue, calls MQINQ to inquire on the values of three of its attributes, constructs a reply message containing these values, and puts the message on the reply-to queue. The program then gets each of the remaining messages on the request queue in turn and generates a reply in the same way. When the request queue is empty, the program closes the queue and disconnects from the queue manager.

2-2

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Required Materials

The RPGLE sample programs amq3req4, amq3ech4 and amq3inq4 or the C sample programs amqsreq4, amqsech4 and amqsinq4 are CALLable from any command line. A text editor such as Source Entry Utility (SEU)

Copyright IBM Corp. 2001

Exercise 2. Implementing Triggering


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

2-3

Student Exercises

Exercise Instructions
Step 1: Configure the queue manager for triggering 1. Create the required objects to cause triggering to occur against the local queue created. Use the REPLACE parameter on all relevant MQSeries CL commands. a. An initiation queue named QL.INITQ_AP. b. A local queue which is enabled for triggering. Call it QL.A. The arrival of the first message on QL.A should trigger the appropiate application. c. A process to identify the application to be started. Define the process in such a way that amq3ech4 or amqsech4 is started synchronously with respect to the execution of the trigger monitor. Call the process PR.ECHO. d. Use a dynamic (TEMP) queue as reply-to-queue which is created by a model queue with a name of QM.A_REPLY. 2. Start the trigger monitor program and remember to name the initiation queue as a parameter. A parm requires 48 characters. Step 2: Test triggering 3. Call amq3req4 or amqsreq4 in order to put some request messages on the local queue that is enabled for triggering. 4. Observe that the trigger monitor starts amq3ech4 or amqsech4 and the replies are received by amq3req4 or amqsreq4. 5. If it did not work, investigate the possible causes. End of Exercise

2-4

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Optional Exercise Instructions


Step 1: Test triggering with amqsinq or amqsinq4. 1. Create a second process object so that amq3inq4 or amqsinq4 is started by the trigger monitor instead of amq3ech4. 2. Alter the queue QL.A appropriately. 3. Run amq3req4 or amqsreq4 again remembering that amq3inq4 or amqsinq4 now expects the application data in each message to contain the name of a queue. The application data could for example be the names of the following queues:

SYSTEM.ADMIN.COMMAND.QUEUE QM.A_REPLY SYSTEM.SAMPLE.REPLY QL.A Try an invalid queue name and see what result is returned.

Step 2: Alter the trigger conditions 4. Alter the values of the attributes of your local queue which control triggering. For example, try using depth triggering. 5. Check that the application is triggered according to the TRGDEPTH value. End of Optional Exercise

Copyright IBM Corp. 2001

Exercise 2. Implementing Triggering


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

2-5

Student Exercises

Exercise Instructions With Hints


Step 1: Configure the queue manager for triggering 1. Create the required objects to cause triggering to occur against the local queue created. Use the REPLACE parameter on all relevant MQSeries CL commands. a. An initiation queue named QL.INITQ_AP.

CRTMQMQ QNAME(QL.INITQ_AP) QTYPE(*LCL) MQMNAME(M##.QM1)


REPLACE(*YES) b. A local queue which is enabled for triggering. Call it QL.A. The arrival of the first message on QL.A should trigger the appropiate application.

CRTMQMQ QNAME(QL.A) QTYPE(*LCL) MQMNAME(M##.QM1)


REPLACE(*YES) TRGENBL(*YES) TRGTYPE(*FIRST) PRCNAME(PR.ECHO) INITQNAME(QL.INITQ_AP) c. A process to identify the application to be started. Define the process in such a way that amq3ech4 or amqsech4 is started synchronously with respect to the execution of the trigger monitor. Call the process PR.ECHO.

CRTMQMPRC PRCNAME(PR.ECHO) MQMNAME(M##.QM1)


REPLACE(*YES) APPID(QMQMSAMP/AMQ3ECH4) or CRTMQMPRC PRCNAME(PR.ECHO) MQMNAME(M##.QM1) REPLACE(*YES) APPID(QMQM/AMQSECH4) d. Use a dynamic (TEMP) queue as reply-to-queue which is created by a model queue with a name of QM.A_REPLY.

CRTMQMQ QNAME(QM.A_REPLY) QTYPE(*MDL)


MQMNAME(M##.QM1) REPLACE(*YES) DFNTYPE(*TEMPDYN) 2. Start the trigger monitor program and remember to name the initiation queue as a parameter. A parm requires 48 characters.

CALL PGM(AMQ3TRG4) PARM(QL.INITQ_AP M##.QM1) or STRMQMTRM MQMNAME(M##.QM1) INITQNAME(QL.INITQ_AP)


Step 2: Test triggering 3. Call amq3req4 or amqsreq4 in order to put some request messages on the local queue that is enabled for triggering.

CALL PGM(AMQ3REQ4) PARM(QL.A M##.QM1 QM.A_REPLY) or CALL PGM(QMQM/AMQSREQ4) PARM(QL.A M##.QM1


QM.A_REPLY)

2-6

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

4. Observe that the trigger monitor starts amq3ech4 or amqsech4 and the replies are received by amq3req4 or amqsreq4. 5. If it did not work, investigate the possible causes.

Was one of the conditions for a trigger event not satisfied? If yes, then
correct the condition and resubmit messages to the application queue, to reactivate the trigger condition evaluation. Check that the number of messages on the queue does not exceed the trigger condition. If exceeded then the trigger condition was missed and the application server (amqsreq4) was not started. Therefore, reset the trigger condition or clear the queue of messages and try the triggering process again.

End of Exercise with Hints

Copyright IBM Corp. 2001

Exercise 2. Implementing Triggering


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

2-7

Student Exercises

Optional Exercise Instructions With Hints


Step 1: Test triggering with amqsinq or amqsinq4. 1. Create a second process object so that amq3inq4 or amqsinq4 is started by the trigger monitor instead of amq3ech4.

CRTMQMPRC PRCNAME(PR.INQ) MQMNAME(M##.QM1) REPLACE(*YES) or CRTMQMPRC PRCNAME(PR.INQ) MQMNAME(M##.QM1)


REPLACE(*YES) APPID(QMQM/AMQSINQ4) 2. Alter the queue QL.A appropriately. APPID(QMQMSAMP/AMQ3INQ4)

CHGMQMQ QNAME(QL.A) QTYPE(*LCL) MQMNAME(M##.QM1)


PRCNAME(PR.INQ) 3. Run amq3req4 or amqsreq4 again remembering that amq3inq4 or amqsinq4 now expects the application data in each message to contain the name of a queue.

CALL PGM(AMQ3REQ4) PARM(QL.A M##.QM1 QM.A_REPLY) or CALL PGM(QMQM/AMQSREQ4)


PARM(QL.A M##.QM1 QM.A_REPLY) SYSTEM.ADMIN.COMMAND.QUEUE QM.A_REPLY SYSTEM.SAMPLE.REPLY QL.A Try an invalid queue name and see what result is returned.

The application data could for example be the names of the following queues:

Step 2: Alter the trigger conditions 4. Alter the values of the attributes of your local queue which control triggering. For example, try using depth triggering.

CHGMQMQ QNAME(QL.A) QTYPE(*LCL) MQMNAME(M##.QM1)


TRGTYPE(*DEPTH) TRGDEPTH(5) 5. Check that the application is triggered according to the TRGDEPTH value.

CALL PGM(AMQ3REQ4) PARM(QL.A M##.QM1 QM.A_REPLY) or CALL PGM(QMQM/AMQSREQ4)


PARM(QL.A M##.QM1 QM.A_REPLY)

End of Optional Exercise with Hints

2-8

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise 3. Recovery

What This Exercise is About


This exercise demonstrates the survival of persistent messages across a queue manager restart. It also demonstrates how a queue that has become damaged can be recovered from its media image.

What You Should Be Able to Do


At the end of the lab, you should be able to:

Create a queue manager using journaling for logging. Put persistent and nonpersistent messages on local queues. Stop and restart a queue manager. Recover a damaged local queue from its media image. Record manually media images to optimize media recovery.

Introduction
For the first step of the exercise you continue to use the queue manager you created earlier because the AS/400 supports journaling as the logging mechanism. Therefore, you do not have to create a new queue manager for this lab, as you would if you were performing this exercise on a different platform.

In step 2 you are asked to damage a queue. Of course, the act of deliberately damaging a queue should not be done in practice. It is done in this exercise in order to simulate a disk failure.

Copyright IBM Corp. 2001


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Exercise 3. Recovery

3-1

Student Exercises

Exercise Instructions
Step 1: Queue manager restart 1. Reuse your existing queue manager. 2. Create two new queues. a. Two local queues named Q3.A and Q3.B. The default persistence of each queue should be set to YES. b. Two alias queues named Q3.AA and Q3.AB. Q3.AA resolves to the local queue Q3.A and Q3.AB to the queue Q3.B. The default persistence of each alias queue should be set to NO. c. Clear the two local queues of all messages. 3. Put a mixture of persistent and non persistent messages on the local queues Q3.A and Q3.B using the sample program amq3put4 OR amqsput4. The sample program AMQSPUT0 when called will require a message to be typed in from standard in. When the supplied sample programs put messages to a queue, the value of the DefPersistence attribute of the queue which is first (explicitly) opened determines whether the message it puts on the queue is persistent or non persistent. In respect to the definitions made before, the sample put program will create:

persistent messages when the named queue is the local queue non persistent messages when the named queue is the alias queue

4. Use the WRKMQMMSG command to browse the messages on the local queue Q3.A and check that there is a mixture of persistent and non persistent messages on it. 5. Stop the queue manager and then start it again. 6. Browse the messages on queue Q3.A. The display shows that only the persistent messages have survived the restart. Step 2: Media recovery 7. Record an image of the queue Q3.B to the MQSeries log. The action of recording a image of a queue or group of queues informs the queue manager that this is to be the new initial image for all subsequent recover actions on the named queue objects. This recovery point is important for queues that are seldom empty when the queue manager is restarted. 8. Locate and then delete the OS/400 file system file entry for the local queue Q3.B. This will result in the queue becoming damaged. 9. Display the attributes of local queue Q3.B. This may still work as the queue manager does not need to access the queue file in order to provide the requested information.

3-2

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

10. Browse local queue Q3.B. The queue manager should now detect that the queue has been damaged and report this fact. 11. Try to display the attributes of local queue Q3.B again. The queue manager will now report that the queue has been damaged. 12. Recover the damaged queue Q3.B from the MQSeries logging system. 13. Display the attributes of the newly recreated queue. 14. Browse the local queue Q3.B, checking to see that the messages have been successfully recovered. 15. What about the non persistent messages? 16. 17. Get the messages from the queue. Stop the queue manager.

End of Exercise

Copyright IBM Corp. 2001


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Exercise 3. Recovery

3-3

Student Exercises

Exercise Instructions With Hints


Step 1: Queue manager restart 1. Reuse your existing queue manager. 2. Create two new queues. a. Two local queues named Q3.A and Q3.B. The default persistence of each queue should be set to YES.

CRTMQMQ QNAME(Q3.A) QTYPE(*LCL) MQMNAME(M##.QM1) CRTMQM QNAME(Q3.B) QTYPE(*LCL) MQMNAME(M##.QM1)


DFTMSGPST(*YES) REPLACE(*YES) b. Two alias queues named Q3.AA and Q3.AB. Q3.AA resolves to the local queue Q3.A and Q3.AB to the queue Q3.B. The default persistence of each alias queue should be set to NO. DFTMSGPST(*YES) REPLACE(*YES)

CRTMQMQ QNAME(Q3.AA) QTYPE(*ALS) TGTQNAME(Q3.A) CRTMQMQ QNAME(Q3.AB) QTYPE(*ALS) TGTQNAME(Q3.B)


MQMNAME(M##.QM1) DFTMSGPST(*NO) REPLACE(*YES) c. Clear the two local queues of all messages. MQMNAME(M##.QM1) DFTMSGPST(*NO) REPLACE(*YES)

CLRMQMQ QNAME(Q3.A) MQMNAME(M##.QM1) CLRMQMQ QNAME(Q3.B) MQMNAME(M##.QM1)


3. Put a mixture of persistent and non persistent messages on the local queues Q3.A and Q3.B using the sample program amq3put4 OR amqsput4. The sample program AMQSPUT0 when called will require a message to be typed in from standard in.

CALL PGM(QMQM/AMQSPUT0) PARM(Q3.A M##.QM1) CALL PGM(QMQM/AMQSPUT0) PARM(Q3.B M##.QM1)


When the supplied sample programs put messages to a queue, the value of the DefPersistence attribute of the queue which is first (explicitly) opened determines whether the message it puts on the queue is persistent or non persistent. In respect to the definitions made before, the sample put program will create:

persistent messages when the named queue is the local queue non persistent messages when the named queue is the alias queue

4. Use the WRKMQMMSG command to browse the messages on the local queue Q3.A and check that there is a mixture of persistent and non persistent messages on it.

WRKMQMMSG MQMNAME(M##.QM1) QNAME(Q3.A)


5. Stop the queue manager and then start it again.

ENDMQM MQMNAME(M##.QM1) STRMQM MQMNAME(M##.QM1)


3-4 MQSeries Sys Admin I for AS/400
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

6. Browse the messages on queue Q3.A. The display shows that only the persistent messages have survived the restart.

WRKMQMMSG MQMNAME(M##.QM1) QNAME(Q3.A) or CALL PGM(QMQM/AMQSBCG4) PARM(Q3.A M##.QM1)


Step 2: Media recovery 7. Record an image of the queue Q3.B to the MQSeries log. The action of recording a image of a queue or group of queues informs the queue manager that this is to be the new initial image for all subsequent recover actions on the named queue objects. This recovery point is important for queues that are seldom empty when the queue manager is restarted.

RCDMQMIMG MQMNAME(M##.QM1) OBJ(Q3.B) OBJTYPE(*LCLQ) or RCDMQMIMG MQMNAME(M##.QM1) OBJ(Q3.*) OBJTYPE(*Q)


8. Locate and then delete the OS/400 file system file entry for the local queue Q3.B. This will result in the queue becoming damaged.

Using IFS display commands, WRKLNK locate the following: Then delete the file named q.
/QIBM/UserData/mqm/qmgrs/your_queue_manager_name/queues/Q3.B

9. Display the attributes of local queue Q3.B. This may still work as the queue manager does not need to access the queue file in order to provide the requested information.

WRKMQMQ MQMNAME(M##.QM1) QNAME(Q3.B)


10. Browse local queue Q3.B. The queue manager should now detect that the queue has been damaged and report this fact.

WRKMQMMSG MQMNAME(M##.QM1) QNAME(Q3.B) or CALL PGM(QMQM/AMQSBCG4) PARM(Q3.B M##.QM1)


11. Try to display the attributes of local queue Q3.B again. The queue manager will now report that the queue has been damaged.

WRKMQMQ MQMNAME(M##.QM1) QNAME(Q3.B)


12. Recover the damaged queue Q3.B from the MQSeries logging system.

RCRMQMOBJ OBJ(Q3.B) OBJTYPE(*LCLQ) MQMNAME(M##.QM1)


13. Display the attributes of the newly recreated queue.

WRKMQMQ MQMNAME(M##.QM1) QNAME(Q3.B)


14. Browse the local queue Q3.B, checking to see that the messages have been successfully recovered.

WRKMQMMSG QNAME(Q3.B) MQMNAME(M##.QM1) or CALL PGM(QMQM/AMQSBCG4) PARM(Q3.B M##.QM1)


15. What about the non persistent messages?

Copyright IBM Corp. 2001


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Exercise 3. Recovery

3-5

Student Exercises

They will not be present, as they are not recovered from the MQSeries
logging system, because they were not recorded in the logs. 16. Get the messages from the queue.

CALL PGM(QMQM/AMQSGET4) PARM(Q3.B M##.QM1) CALL PGM(AMQ3GET4) PARM(Q3.B M##.QM1)


17. Stop the queue manager.

ENDMQM MQMNAME(M##.QM1)
End of Exercise with Hints

3-6

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise 4. Distributed Queueing

What This Exercise is About


The aim of this exercise is for the student teams to establish MQSeries channel connections between their queue managers. Then to send and receive messages between applications connected to these queue managers.

What You Should Be Able to Do


At the end of the lab, you should be able to:

Create and manage the objects required for distributed queuing. Start message channels manually. Test the flow of messages across the channels using sample applications.

and, if time permits:

Use triggering to activate the server application in a distributed environment. Use the channel initiator to start channels on the arrival of a message.

Introduction
This exercise can de done individually or in teams of two. You will need to configure two queue managers for this exercise, with two message channels between them for message flow in each direction. The exercise uses TCP/IP as the communications protocol. The Instructor will tell you the host names or IP address with assigned port # of your system.

Note: If you do not have MQSeries for AS/400 V5.2 or above, then you can only create a single queue manager on the AS/400. Hence, in order to complete this exercise you will require one or more other computers which support MQSeries queue managers (e.g. AS/400, RS/6000, Windows NT etc.) and they must be on the same network as your AS/400.

Required Materials

The sample programs amq3put4, amq3get4, amq3req4 and amq3ech4.


Exercise 4. Distributed Queueing
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

4-1

Student Exercises

or The sample programs amqsput0, amqsget4, amqsreq4 and amqsech4. A text editor. The following items must be obtained from the instructor, or by agreement with your partner team, before this exercise can be undertaken. The hostname or network address of the AS/400 hosting your queue manager. The TCP/IP port number that your queue manager can use to receive incomming requests from your partner queue managers. The hostname or network address of the partner machine hosting their queue manager. The TCP/IP port number that the partner queue manager will be listening on for requests from your queue manager.

4-2

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise Instructions
Step 1: Create and configure the required connection objects 1. Continue to use the queue manager from the previous exercises. 2. Start the queue manager, if not currently running. 3. Be sure that no channel initiator is running. 4. Use the AS/400 MQSeries CL commands interactively to create the channel definitions that are required for a connection between your local queue manager and the partner queue manager. The necessary objects are the following: a. A definition of a message channel (type = sender). Channel name = CH.M##_M$$ (## is your team number / $$ is the partner team number) Protocol = TCP/IP Network address and port number of the partner team queue manager. e.g. (1.2.3.4 (9001)) Transmission queue name = name of the remote qmgr b. A definition of a message channel ( type = receiver) The attributes should match to sender channel of partner team. c. A transmission queue with the same name as the remote queue manager. d. A dead letter queue named QL.DLQ/M##.QM1 (## is your team number.) e. Change the queue manager to use the just created queue as its Dead Letter Queue.

Step 2: Configure and activate the required TCP listener function 5. Start the MQSeries listener for your queue manager listening on your tcpip port. Step 3: Test and if successful start the connection 6. Ping the message channel from the sender end in order to test the channel definitions. Check for successful completion. 7. Start the connection channel and verify it is working. Step 4: Create the required application objects

Copyright IBM Corp. 2001

Exercise 4. Distributed Queueing


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

4-3

Student Exercises

8. Create a local queue and a local definition of the remote queue. a. Define or redefine the local queue Q4.ST04. b. Define or redefine the local definition of the remote queue Q4.ST04 on the partner queue manager using name Q4.ST04.ON.M$$, where $$ is your partner team number.

Step 5: Test distributed queueing 9. Use either the sample program AMQ3PUT4 or AMQSPUT4 to send messages to the queue Q4.ST04 on the partner queue manager. 10. Use either AMQ3GET4, AMQSGET4, AMQ3GBR4, or WRKMQMQ to check for successful arrival of messages from your partner team. 11. If the messages do not arrive, investigate the possible causes and solve the problem together with your partner team. Notice The channel connections created in this exercise will be reused in exercise 6.

End of Exercise

4-4

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Optional Exercise Instructions


Step 1: Start the channel automatically. 1. Stop the sender channel, from the previous steps of this exercise, if it is currently running. 2. Create a new command file named E4_OX1 in your team library (MQ16##/QMQSC). Edit this file to perform the following MQSeries command. Redefine the transmission queue, used by the sender channel, setting the following queue attributes. Set trigger control to on. Set the initiation queue to QL.CHL.INITQ. Set the trigger data to the name of the sender channel. Set trigger type to first. Set the trigger message priority to 0. 3. Add a command to the command file to alter the sender channel definition attributes to indicate that the channel is to end after thirty (30) seconds of no activity. 4. Add a command to the command file to define the channel initiation queue, QL.CHL.INITQ. 5. Process this command file using STRMQMMQSC. 6. Start the channel initiator, specifying queue QL.CHL.INITQ at the qname parameter. 7. Display the status of the sender channel, using the WRKMQMCHL panel, until the channel status has changed from running to inactive. Remember to press the refresh key to update the display panel. 8. Now start the channel automatically, by putting messages to the remote queue definition. End of Optional Exercise

Copyright IBM Corp. 2001

Exercise 4. Distributed Queueing


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

4-5

Student Exercises

Exercise Instructions With Hints


Step 1: Create and configure the required connection objects 1. Continue to use the queue manager from the previous exercises. 2. Start the queue manager, if not currently running.

STRMQM MQMNAME(M##.QM1)
3. Be sure that no channel initiator is running.

WRKSBSJOB QMQM Check to see that no RUNMQCHI jobs are running. If so, then end the
RUNMQCHI jobs. 4. Use the AS/400 MQSeries CL commands interactively to create the channel definitions that are required for a connection between your local queue manager and the partner queue manager. The necessary objects are the following: a. A definition of a message channel (type = sender). Channel name = CH.M##_M$$ (## is your team number / $$ is the partner team number) Protocol = TCP/IP Network address and port number of the partner team queue manager. e.g. (1.2.3.4 (9001)) Transmission queue name = name of the remote qmgr

CRTMQMCHL CHLNAME(CH.M##_M$$)
CHLTYPE(*SDR) MQMNAME(M##.QM1) REPLACE(*YES) TRPTYPE(*TCP) CONNAME(partner_hostname_or_network_address (partner_queue_manager_port_number)) TMQNAME(M$$.QM1) b. A definition of a message channel ( type = receiver) The attributes should match to sender channel of partner team.

CRTMQMCHL CHLNAME(CH.M$$_M##)
CHLTYPE(*RCVR) MQMNAME(M##.QM1) REPLACE(*YES) TRPTYPE(TCP) c. A transmission queue with the same name as the remote queue manager.

CRTMQMQ QNAME(M$$.QM1) QTYPE(*LCL) USAGE(*TMQ)


MQMNAME(M##.QM1) REPLACE(*YES) d. A dead letter queue named QL.DLQ/M##.QM1 (## is your team number.)

CRTMQMQ QNAME(QL.DLQ) QTYPE(*LCL) MQMNAME(M##.QM1)


4-6 MQSeries Sys Admin I for AS/400
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

REPLACE(*YES) e. Change the queue manager to use the just created queue as its Dead Letter Queue.

CHGMQM MQMNAME(M##.QM1) UDLMSGQ(QL.DLQ)


Step 2: Configure and activate the required TCP listener function 5. Start the MQSeries listener for your queue manager listening on your tcpip port.

STRMQMLSR MQMNAME(M##.QM1)
PORT(your_queue_manager_port_number)

Step 3: Test and if successful start the connection 6. Ping the message channel from the sender end in order to test the channel definitions.

PNGMQMCHL CHLNAME(CH.M##_M$$) MQMNAME(M##.QM1)


Check for successful completion. 7. Start the connection channel and verify it is working.

STRMQMCHL CHLNAME(CH.M##_M$$) MQMNAME(M##.QM1) WRKMQMCHL MQMNAME(M##.QM1) CHLNAME(CH.M*)


The status of the channel must be active, to be correct. If the channel status is retrying, then the partner port number is not being listened to, ie. the listener is either not running or is listening on a different port. Have the partner correct the situation or stop the channel, alter the port number a channel. If the channel status is stopped, it has failed to start due to an unrecoverable error. Check the QMQM subsystem job log for error messages and correct the problem and resubmit the command.

Step 4: Create the required application objects 8. Create a local queue and a local definition of the remote queue. a. Define or redefine the local queue Q4.ST04. b. Define or redefine the local definition of the remote queue Q4.ST04 on the partner queue manager using name Q4.ST04.ON.M$$, where $$ is your partner team number.

CRTMQMQ QNAME(Q4.ST04) QTYPE(*LCL) MQMNAME(M##.QM1) CRTMQMQ QNAME(Q4.ST04.ON.M$$) QTYPE(*RMT)


MQMNAME(M##.QM1) REPLACE(*YES) RMTQNAME(Q4.ST04) RMTMQMNAME(M$$.QM1) TMQNAME(M$$.QM1) REPLACE(*YES)

Copyright IBM Corp. 2001

Exercise 4. Distributed Queueing


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

4-7

Student Exercises

Step 5: Test distributed queueing 9. Use either the sample program AMQ3PUT4 or AMQSPUT4 to send messages to the queue Q4.ST04 on the partner queue manager.

CALL PGM(QMQM/AMQSPUT0) PARM(Q4.ST04.ON.M$$ M##.QM1) or CALL PGM(AMQ3PUT4) PARM(Q4.ST04.ON.M$$ M##.QM1 )


10. Use either AMQ3GET4, AMQSGET4, AMQ3GBR4, or WRKMQMQ to check for successful arrival of messages from your partner team.

CALL PGM(QMQM/AMQSGET4) PARM(Q4.ST04 M##.QM1)


11. If the messages do not arrive, investigate the possible causes and solve the problem together with your partner team.

If the messages are in the sending queue managers deadletter queue, then
the queue manager name, as coded in the QR definition was not resolvable. If the messages are in the receiving queue managers deadletter queue, then the queue name, as coded in the QR definition was not resolvable. Notice The channel connections created in this exercise will be reused in exercise 6.

End of Exercise with hints

4-8

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Optional Exercise Instructions With Hints


Step 1: Start the channel automatically. 1. Stop the sender channel, from the previous steps of this exercise, if it is currently running.

WRKMQMCHL MQMNAME(M##.QM1) CHLNAME(CH.M##_M$$) Select option 15 to end the channel.


2. Create a new command file named E4_OX1 in your team library (MQ16##/QMQSC). Edit this file to perform the following MQSeries command. Redefine the transmission queue, used by the sender channel, setting the following queue attributes. Set trigger control to on. Set the initiation queue to QL.CHL.INITQ. Set the trigger data to the name of the sender channel. Set trigger type to first. Set the trigger message priority to 0.

DEFINE QL(M$$.QM1) USAGE(XMITQ) REPLACE +


TRIGGER TRIGDATA(CH.M##_M$$) + INITQ(QL.CHL.INITQ) + TRIGMPRI(0) TRIGTYPE(FIRST) 3. Add a command to the command file to alter the sender channel definition attributes to indicate that the channel is to end after thirty (30) seconds of no activity.

ALTER CHL(CH.M##_M$$) CHLTYPE(SDR) TRPTYPE(TCP) +


DISCINT(30) 4. Add a command to the command file to define the channel initiation queue, QL.CHL.INITQ.

DEFINE QL(QL.CHL.INITQ) REPLACE


5. Process this command file using STRMQMMQSC.

STRMQMMQSC SRCMBR(E4_OX1) SRCFILE(MQ16##/QMQSC)


MQMNAME(M##.QM1) 6. Start the channel initiator, specifying queue QL.CHL.INITQ at the qname parameter.

STRMQMCHLI MQMNAME(M##.QM1) QNAME(QL.CHL.INITQ)


7. Start the sender channel, using the WRKMQMCHL panel option 14.

WRKMQMCHL MQMNAME(M##.QM1) CHLNAME(CH.M##_M$$) Then select option option 14 to start the selected channel.
8. Display the status of the sender channel, using the WRKMQMCHL panel, until the channel status has changed from running to inactive.
Copyright IBM Corp. 2001 Exercise 4. Distributed Queueing
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

4-9

Student Exercises

Remember to press the refresh key to update the display panel.

The status column should initially indicate running if the start request has Press the refresh key (key 5), to update the screen image. The status of the selected channel will become inactive, after the period of
inactivity as expressed by the disconnect interval value, has elapsed. 9. Now start the channel automatically, by putting messages to the remote queue definition. been successful.

CALL PGM(QMQM/AMQSPUT0) PARM(Q4.ST04.ON.M$$ M##.QM1) or CALL PGM(AMQ3PUT4) PARM(Q4.ST04.ON.M$$ M##.QM1 )


10. Display the channel status, again using the WRKMQMCHL panel, observing that the status has changed from inactive to running. After 30 seconds of no messages appearing on the transmission queue the channel status will change from running to inactive again.

WRKMQMCHL MQMNAME(M##.QM1) CHLNAME(CH.M##_M$$) remember to refresh the panel display frequently to see the current status
of the channel.

End of Optional Exercise with Hints

4-10

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise 5. Queue Manager Clusters

What This Exercise is About


The aim of this exercise is to set up a simple queue manager cluster.

What You Should Be Able to Do


At the end of the lab, you should be able to:

Create clusters. Define all required MQSeries objects for queue manager clusters. Test and configure clusters. Manage workload in clusters.

Introduction
Every team will create a new queue manager to be a member of a queue manager cluster. A group of at least three queue managers will join the same cluster. The instructor will show you the naming convention used to name the required MQSeries objects.

Required Materials

Sample programs amq3put4 and amq3get4. A file containing nine messages. A text editor.

Copyright IBM Corp. 2001

Exercise 5. Queue Manager Clusters


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

5-1

Student Exercises

Exercise Instructions
1. Perform the following steps from one queue manager at a time. Step 1: Set up the cluster connections 2. Create a new default queue manager M#.QM3 to be used in a queue manager cluster. 3. Start that queue manager and the command server. 4. Start the listener function for your queue manager M#.QM3 on port 9003 using the MQSeries listener. 5. Create a member in your QMQSC file, called E5_ST01, to define the cluster connection objects required for your queue manager. The objects needed should include the following. a. One local Queue to be used as Dead Letter Queue b. One cluster receiver channel pointing to the owning queuemanager. c. One cluster sender channel pointing to a (the other) repository queue manager in your cluster. Use the following attributes for all cluster channels: DISCINT(30) SHORTRTY(600) SHORTTMR(60) d. Wait until all channels timed out upon the DISCINT value. e. What is the CURDEPTH on the SYSTEM.CLUSTER.REPOSITORY.QUEUEs? f. The odd-numbered queue managers in each cluster should hold a full repository. g. Watch again the channel activity in the listener windows on all queue managers in the cluster during processing the ALTER Command. h. Wait until all channels timed out upon the DISCINT value. i. What is now the CURDEPTH on the SYSTEM.CLUSTER.REPOSITORY.QUEUEs?

Step 2: Set up the cluster application objects 6. Prepare a second member in your QMQSC file, called E5_ST02 to define the cluster application objects required on your queue manager. Define all queues with DEFPSIST(YES) and for all cluster queues DEFBIND(OPEN). (# / x = owning/partner team/machine number) a. Local queue QL.A (exists in all queue managers b. Local queue QL.A/M# (exists only in this queue manager)
5-2 MQSeries Sys Admin I for AS/400
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

c. Local cluster queue QL.C/M# (exists only in this queue manager = single instance Q) (CLUS_$ = assigned cluster name) 7. Process the prepared command script file. 8. Watch again the listener windows during processing of the command script. Channels are started to propagate the new information. 9. Wait until all channels timed out upon the DISCINT value. 10. What is now the CURDEPTH on the SYSTEM.CLUSTER.REPOSITORY.QUEUEs? Step 3: Test clustering 11. Prepare a text file with 11 messages. Each message should contain a sequence number. Use this text file in the following steps with amq3put4t via standard input (file inclusion). Example:

0001 MSG msg text............... 0002 MSG msg text............... 0003 MSG msg text............... : :
12. From the non-repository queue manager run amq3put4 to put messages on different queues and check, on which queue the messages arrive and if there is channel activity during the operation. Use the following queues: a. QL.A (non-cluster queue - same queue in all queue managers) b. QL.A/M#. (non-cluster queue - unique queue for each team) c. QL.A/Mx. (non-cluster queue - unique queue for each team) d. QL.C/Mx (cluster queue - single instance) e. QL.Cx (Cluster queue - multiple instance - x = 1. other team) f. QL.Cx (Cluster queue - multiple instance - x = 2. other team) g. QL.C# (Cluster queue multiple instance - # = own team h. QL.C# (Cluster queue multiple instance - # = own team i. QL.C# (Cluster queue multiple instance - # = own team 13. Set DEFBIND(NOTFIXED) for QL.C# on all queue managers in your cluster. Is there any channel activity in the whole cluster? 14. Put again 11 messages to QL.C#. 15. In which way now the messages arrive on the destination queue and is there any channel activity? 16. Again put 11 messages to QL.C#. 17. Stop one of the remote cluster queue managers. 18. Again put 11 messages to QL.C#.
Copyright IBM Corp. 2001 Exercise 5. Queue Manager Clusters
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

5-3

Student Exercises

19. Restart the previously stopped cluster queue manager. 20. Disable puts on queue QL.C# on the other cluster queue manager 21. Again put 11 messages to QL.C#. 22. Disable puts on all queue instances of QL.C# in your cluster. 23. Again put 11 messages to QL.C#. 24. Explain the error indication you get. End of Exercise

5-4

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise Instructions With Hints


1. Perform the following steps from one queue manager at a time. Step 1: Set up the cluster connections 2. Create a new default queue manager M#.QM3 to be used in a queue manager cluster. 3. Start that queue manager and the command server. 4. Start the listener function for your queue manager M#.QM3 on port 9003 using the MQSeries listener. 5. Create a member in your QMQSC file, called E5_ST01, to define the cluster connection objects required for your queue manager. The objects needed should include the following. a. One local Queue to be used as Dead Letter Queue b. One cluster receiver channel pointing to the owning queuemanager. c. One cluster sender channel pointing to a (the other) repository queue manager in your cluster. Use the following attributes for all cluster channels: DISCINT(30) SHORTRTY(600) SHORTTMR(60) d. Wait until all channels timed out upon the DISCINT value. e. What is the CURDEPTH on the SYSTEM.CLUSTER.REPOSITORY.QUEUEs? f. The odd-numbered queue managers in each cluster should hold a full repository. g. Watch again the channel activity in the listener windows on all queue managers in the cluster during processing the ALTER Command. h. Wait until all channels timed out upon the DISCINT value. i. What is now the CURDEPTH on the SYSTEM.CLUSTER.REPOSITORY.QUEUEs?

Step 2: Set up the cluster application objects 6. Prepare a second member in your QMQSC file, called E5_ST02 to define the cluster application objects required on your queue manager. Define all queues with DEFPSIST(YES) and for all cluster queues DEFBIND(OPEN). (# / x = owning/partner team/machine number) a. Local queue QL.A (exists in all queue managers b. Local queue QL.A/M# (exists only in this queue manager)
Copyright IBM Corp. 2001 Exercise 5. Queue Manager Clusters
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

5-5

Student Exercises

c. Local cluster queue QL.C/M# (exists only in this queue manager = single instance Q) (CLUS_$ = assigned cluster name) 7. Process the prepared command script file. 8. Watch again the listener windows during processing of the command script. Channels are started to propagate the new information. 9. Wait until all channels timed out upon the DISCINT value. 10. What is now the CURDEPTH on the SYSTEM.CLUSTER.REPOSITORY.QUEUEs? Step 3: Test clustering 11. Prepare a text file with 11 messages. Each message should contain a sequence number. Use this text file in the following steps with amq3put4t via standard input (file inclusion). Example:

0001 MSG msg text............... 0002 MSG msg text............... 0003 MSG msg text............... : :
12. From the non-repository queue manager run amq3put4 to put messages on different queues and check, on which queue the messages arrive and if there is channel activity during the operation. Use the following queues: a. QL.A (non-cluster queue - same queue in all queue managers) b. QL.A/M#. (non-cluster queue - unique queue for each team) c. QL.A/Mx. (non-cluster queue - unique queue for each team) d. QL.C/Mx (cluster queue - single instance) e. QL.Cx (Cluster queue - multiple instance - x = 1. other team) f. QL.Cx (Cluster queue - multiple instance - x = 2. other team) g. QL.C# (Cluster queue multiple instance - # = own team h. QL.C# (Cluster queue multiple instance - # = own team i. QL.C# (Cluster queue multiple instance - # = own team 13. Set DEFBIND(NOTFIXED) for QL.C# on all queue managers in your cluster. Is there any channel activity in the whole cluster? 14. Put again 11 messages to QL.C#. 15. In which way now the messages arrive on the destination queue and is there any channel activity? 16. Again put 11 messages to QL.C#. 17. Stop one of the remote cluster queue managers. 18. Again put 11 messages to QL.C#.
5-6 MQSeries Sys Admin I for AS/400
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

19. Restart the previously stopped cluster queue manager. 20. Disable puts on queue QL.C# on the other cluster queue manager 21. Again put 11 messages to QL.C#. 22. Disable puts on all queue instances of QL.C# in your cluster. 23. Again put 11 messages to QL.C#. 24. Explain the error indication you get. End of Exercise with Hints

Copyright IBM Corp. 2001

Exercise 5. Queue Manager Clusters


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

5-7

Student Exercises

5-8

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise 6. MQSeries Client Implementation

What This Exercise is About


The aim of this exercise is to set up a MQSeries client to MQSeries server environment. In addition, the use of auto-definition and remote administration will be demonstrated.

What You Should Be Able to Do


At the end of the lab, you should be able to:

Configure a server for client connection. Configure a client. Test a client to server environment. Use auto-definition of a channel.

and, if time permits:

Setup and perform remote administration.

Introduction
You will work in teams of two for the first step. The instructor will be the server for the second step. To put, browse and get messages on your client system, you use sample programs. The following is a brief description of each of the programs you may need to use. amqsputc This program is invoked the same way as amqsput and has the same parameter structure. But it connects to a MQSeries client instead of a MQSeries server. amqsbcgc This program is invoked the same way as amqsbcg and has the same parameter structure but it connects to a MQSeries client. amqsgetc This program is invoked the same way as amqsget and has the same parameter structure but it connects to a MQSeries client. As the AS/400 does not provide a Client Facility, this lab requires other MQSeries clients, (e.g. Windows NT) to be connected to the AS/400 network so that the AS/400 can act as the MQSeries server.

Copyright IBM Corp. 2001

Exercise 6. MQSeries Client Implementation


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

6-1

Student Exercises

Required Materials

MQSeries for AS/400 V.5.2 installed on the system. The sample programs amq3put4, amq3gbr4, and amq3get4 are CALLable from any command line. A text editor such as Source Entry Utility (SEU).

6-2

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Exercise Instructions
In this exercise your system will provide the following function: a. Your queue manager will be the server for the MQSeries clients of your partner teams.

Step 1: Server queue manager setup 1. Reuse the queue manager used in the exercise 1 (probably M##.QM1) to be used as a server queue manager. 2. On the AS/400 create a user profile for MQ05 with the assigned group of QMQMADM. 3. On the PC make sure user MQ05 is a user in the MQM group. 4. On that queue manager define a SVRCONN channel to make your queue manger connectable by MQSeries Clients. a. Use CH.CLNT_M##.TCP as the channel name. b. Protocol is TCP 5. Be sure that an appropriate listener function is active for the server queue manager. Step 2: Client environment setup (Method 1) 6. Use the MQSERVER environment variable to provide a client-connection channel definition for access to the partner team server queue manager. Step 3: Test the Client connection (Setup Method 1) 7. Ensure your partner team has completed the server setup. 8. Use amqsputc to put messages on the local queue QL.A on the server. Make sure you are at the correct path where the amqsputc sample program resides. - i.e. mqm/bin 9. Use amqsbcgc to browse the messages on the server queue. 10. Use amqsgetc to get the messages from the server queue.

Step 4: Server queue manager setup using Auto-definition of channels 11. Enable Channel Auto Definition in your queue manager so all teams are able to connect to your queue manager. Step 5: Client Setup (Method 2) 12. Using your own queue manager to build a client channel definition table to enable a MQSeries client to connect to each queue manager in the classroom which has enabled channel auto definition.

Copyright IBM Corp. 2001

Exercise 6. MQSeries Client Implementation


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

6-3

Student Exercises

a. Create a 1. group of 2 channel entries to connect to the queue manager you specify as the second parm of amqsputc. Use CH.CLNT/S#.TCP as channelname. (# = is just a sequence number i.e. 1, 2, 3,... b. Create two other groups of channels to connect to other queue managers where the name of the queue manager is not checked. For the 1. group use CH.CLNT/A#.TCP as channelname with QMNAME(GRPA). For the 2. group use CH.CLNT/B#.TCP as channelname with QMNAME( ). (# = is just a sequence number i.e. 1, 2, 3,... The instructor will tell you which queue manager belongs to which group.

Step 6: Test the Client connection (Setup Method 2) 13. Ensure your partner teams have completed their server setup. 14. On the client system ensure the following environment variables is pointing to the just created client channel definition table. MQCHLLIB=...... MQCHLTAB=...... 15. Use amqsputc again to put a message to QL.A on the 1. and 2. queue manager of the 1. group and ensure that the operation is completed successfully only if the specified queue manager is the connected server queue manager. 16. Use amqsputc again to put a message to QL.A on a queue manager of the 2. group by specifying GRPA as the 2. parm with amqsputc and ensure that the operation is completed successfully with every queue manager in that group depending which one is found active first. 17. Use amqsputc again to put a message to QL.A on a queue manager of the 3. group by omitting the 2. parm with amqsputc and ensure that the operation is completed successfully with every queue manager in that group depending which one is found active first. 18. Always check if the message is put on the QL.A in the appropriate server queue manager. End of Exercise

6-4

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

Optional Exercise Instructions


The purpose of this exercise is perform administration on a remote queue manager using runmqsc and the command server. You will reuse the queue mangers and channel connections established in exercise 4. Step 1 Reconnect to the remote queue manager 1. Start the command server in that queue manager so remote administration can be performed also by your partner team. 2. On both sides, make sure the channels are using a transmission queue with the same name as the appropriate remote queue manager. 3. The channels need to be active (or triggered) for this to work. Step 2 Test remote administration 4. Change the managing queue manager to run as a default queue manager. 5. On the managing queue manager, issue runmqsc to manage the other queue manager. 6. Use the following command to check if you are connected to the target (managed) queue manager.

DISPLAY QMGR
7. Issue some simple commands like DISPLAY Q(*). 8. Change the target queue manager s description and change QL.A to disable puts. 9. On the managed queue manager, check using runmqsc that these changes have occurred. End of Optional Exercise

Copyright IBM Corp. 2001

Exercise 6. MQSeries Client Implementation


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

6-5

Student Exercises

Exercise Instructions With Hints


In this exercise your system will provide the following function: a. Your queue manager will be the server for the MQSeries clients of your partner teams.

Step 1: Server queue manager setup 1. Reuse the queue manager used in the exercise 1 (probably M##.QM1) to be used as a server queue manager. 2. On the AS/400 create a user profile for MQ05 with the assigned group of QMQMADM. 3. On the PC make sure user MQ05 is a user in the MQM group. 4. On that queue manager define a SVRCONN channel to make your queue manger connectable by MQSeries Clients. a. Use CH.CLNT_M##.TCP as the channel name. b. Protocol is TCP

CRTMQMCHL CHLNAME(CH.CLNT_M##.TCP) CHLTYPE(*SRVCN)


TRPTYPE(TCP) MQMNAME(M##.QM1) MCAUSER(MQ05) 5. Be sure that an appropriate listener function is active for the server queue manager.

STRMQMLSR MQMNAME(M##.QM1) PORT(90##)


Step 2: Client environment setup (Method 1) 6. Use the MQSERVER environment variable to provide a client-connection channel definition for access to the partner team server queue manager. Unix Systems

export MQSERVER=CH.CLNT_M##.TCP/TCP/M##.QM1(90##)
Windows NT/2000

SET MQSERVER=CH.CLNT_M##.TCP/TCP/M##.QM1:90##

Step 3: Test the Client connection (Setup Method 1) 7. Ensure your partner team has completed the server setup. 8. Use amqsputc to put messages on the local queue QL.A on the server. Make sure you are at the correct path where the amqsputc sample program resides. - i.e. mqm/bin

amqsputc QL.A M##.QM1


9. Use amqsbcgc to browse the messages on the server queue.
6-6 MQSeries Sys Admin I for AS/400
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

amqsbcgc QL.A M##.QM1 The value of Reply-to-qmgr in the MQMD will show you, which server
queue manager was connected and has created the message. 10. Use amqsgetc to get the messages from the server queue.

amqsgetc QL.A M##.QM1

Step 4: Server queue manager setup using Auto-definition of channels 11. Enable Channel Auto Definition in your queue manager so all teams are able to connect to your queue manager.

ALTER QMGR CHAD(ENABLED)


Step 5: Client Setup (Method 2) 12. Using your own queue manager to build a client channel definition table to enable a MQSeries client to connect to each queue manager in the classroom which has enabled channel auto definition. a. Create a 1. group of 2 channel entries to connect to the queue manager you specify as the second parm of amqsputc. Use CH.CLNT/S#.TCP as channelname. (# = is just a sequence number i.e. 1, 2, 3,...

DEF CHL(CH.CLNT/S1.TCP) CHLTYPE(CLNTCONN) REPLACE +


TRPTYPE(TCP) + CONNAME(M(9001) ) + QMNAME(M.QM1) DEF CHL(CH.CLNT/S2.TCP) CHLTYPE(CLNTCONN) REPLACE + TRPTYPE(TCP) + CONNAME(M(9001) ) + QMNAME(M.QM1) ( = other team number) b. Create two other groups of channels to connect to other queue managers where the name of the queue manager is not checked. For the 1. group use CH.CLNT/A#.TCP as channelname with QMNAME(GRPA). For the 2. group use CH.CLNT/B#.TCP as channelname with QMNAME( ). (# = is just a sequence number i.e. 1, 2, 3,... The instructor will tell you which queue manager belongs to which group.

DEF CHL(CH.CLNT/A1.TCP) CHLTYPE(CLNTCONN) REPLACE +


TRPTYPE(TCP) + CONNAME(M(9001 ) + QMNAME(GRPA)

Copyright IBM Corp. 2001

Exercise 6. MQSeries Client Implementation


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

6-7

Student Exercises

DEF CHL(CH.CLNT/A2.TCP) CHLTYPE(CLNTCONN) REPLACE +


TRPTYPE(TCP) + CONNAME(M(9001 ) + QMNAME(GRPA) DEF CHL(CH.CLNT/B1.TCP) CHLTYPE(CLNTCONN) REPLACE + TRPTYPE(TCP) + CONNAME(M(9001 ) + QMNAME( ) DEF CHL(CH.CLNT/B2.TCP) CHLTYPE(CLNTCONN) REPLACE + TRPTYPE(TCP) + CONNAME(M(9001 ) + QMNAME( ) ( = other team number)

Step 6: Test the Client connection (Setup Method 2) 13. Ensure your partner teams have completed their server setup. 14. On the client system ensure the following environment variables is pointing to the just created client channel definition table. MQCHLLIB=...... MQCHLTAB=...... UNIX Systems Default location on the creating queue manager:

e x p o r t M Q C H L L I B = / v a r / m q m / q m g r s / < qmgrname> / @ i p c c export MQCHLTAB=amqclchl.tab


Windows NT/2000 Default location on the creating queue manager:

SET MQCHLLIB=..mqmqmgrs < qmgrname > @ipcc SET MQCHLTAB=amqclchl.tab


15. Use amqsputc again to put a message to QL.A on the 1. and 2. queue manager of the 1. group and ensure that the operation is completed successfully only if the specified queue manager is the connected server queue manager.

amqsputc QL.A MQM1


16. Use amqsputc again to put a message to QL.A on a queue manager of the 2. group by specifying GRPA as the 2. parm with amqsputc and ensure that the operation is completed successfully with every queue manager in that group depending which one is found active first.

amqsputc QL.A *GRPA


17. Use amqsputc again to put a message to QL.A on a queue manager of the 3. group by omitting the 2. parm with amqsputc and ensure that the operation is

6-8

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

Student Exercises

completed successfully with every queue manager in that group depending which one is found active first.

amqsputc QL.A
18. Always check if the message is put on the QL.A in the appropriate server queue manager. End of Exercise

Copyright IBM Corp. 2001

Exercise 6. MQSeries Client Implementation


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

6-9

Student Exercises

Optional Exercise Instructions


The purpose of this exercise is perform administration on a remote queue manager using runmqsc and the command server. You will reuse the queue mangers and channel connections established in exercise 4. Step 1 Reconnect to the remote queue manager 1. Start the command server in that queue manager so remote administration can be performed also by your partner team.

strmqcsv [ qmgrname ]
2. On both sides, make sure the channels are using a transmission queue with the same name as the appropriate remote queue manager. 3. The channels need to be active (or triggered) for this to work. Step 2 Test remote administration 4. Change the managing queue manager to run as a default queue manager. 5. On the managing queue manager, issue runmqsc to manage the other queue manager.

runmqsc -w 15 <remote qmgrname >


(where -w 15 is the wait time for responses). 6. Use the following command to check if you are connected to the target (managed) queue manager.

DISPLAY QMGR
7. Issue some simple commands like DISPLAY Q(*). 8. Change the target queue manager s description and change QL.A to disable puts. 9. On the managed queue manager, check using runmqsc that these changes have occurred. End of Optional Exercise

6-10

MQSeries Sys Admin I for AS/400


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Copyright IBM Corp. 2001

IBML

Das könnte Ihnen auch gefallen