Beruflich Dokumente
Kultur Dokumente
Student Exercises
ERC1.0
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.
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.
iii
Student Exercises
iv
Student Exercises
Contents
Exercise Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vii
Exercises
Exercise 1. Working with Queues
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
Student Exercises
vi
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.
Exercise Description
vii
Student Exercises
viii
Student Exercises
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.
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
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
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
Student Exercises
1-5
Student Exercises
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.
DSPMQM MQMNAME(M##.QM1)
b. List the names of all the queues whose names begin with the characters SYSTEM.
1-6
Student Exercises
WRKMQMQ MQMNAME(M##.QM1) and F6=Create h. Display all the attributes of the queue.
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.
1-7
Student Exercises
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.
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.
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.
Student Exercises
CALL PGM(AMQ3PUT4)
PARM(QL.A M##.QM1)
19. Work with MQSeries messages to verify messages were put on queues.
1-9
Student Exercises
1-10
Student Exercises
1-11
Student Exercises
1-12
Student Exercises
Create the objects required for triggering. Start a trigger monitor. Use sample programs to test triggering.
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.
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
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)
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
Student Exercises
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
2-5
Student Exercises
2-6
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.
2-7
Student Exercises
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.
2-8
Student Exercises
Exercise 3. Recovery
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.
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
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
Exercise 3. Recovery
3-3
Student Exercises
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.
Student Exercises
6. Browse the messages on queue Q3.A. The display shows that only the persistent messages have survived the restart.
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.
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.
ENDMQM MQMNAME(M##.QM1)
End of Exercise with Hints
3-6
Student Exercises
Create and manage the objects required for distributed queuing. Start message channels manually. Test the flow of messages across the channels using sample applications.
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
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
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
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
Student Exercises
4-5
Student Exercises
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.
Student Exercises
REPLACE(*YES) e. Change the queue manager to use the just created queue as its Dead Letter Queue.
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.
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.
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.
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.
4-8
Student Exercises
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
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.
WRKMQMCHL MQMNAME(M##.QM1) CHLNAME(CH.M##_M$$) remember to refresh the panel display frequently to see the current status
of the channel.
4-10
Student Exercises
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.
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.
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
Student Exercises
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.
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
5-7
Student Exercises
5-8
Student Exercises
Configure a server for client connection. Configure a client. Test a client to server environment. Use auto-definition of a channel.
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.
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
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.
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
Student Exercises
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-5
Student Exercises
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
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
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.
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.
6-7
Student Exercises
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:
6-8
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
6-9
Student Exercises
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.
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
IBML