08.10.2013 Views

Tutorial 7

Tutorial 7

Tutorial 7

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

tutor07.doc<br />

<strong>Tutorial</strong> 7<br />

MQSeries<br />

Copyright © Abt. Computersysteme, Institut für Informatik, Universität Leipzig<br />

In this exercise, we design a message queue, send a messages and read it back again.<br />

Note: This tutorial was generated with the user-ID "PRAKT20". In all file names, you must replace<br />

"PRAKT20" by your own user-ID. Moreover, PRAKTxx is used often in the text below, whereby the xx<br />

should be your user ID.<br />

Exercise: Work through the following tutorial<br />

MQSeries<br />

For commercial Messaging and Queuing, MQSeries represents a platform independent<br />

Middleware-product. It is used especially in high speed - implementations of distributed<br />

applications. MQSeries is popular, because it is possible to develop and test MQSeries<br />

applications with a minimum amount of time and resources.<br />

Since MQSeries is capable of running on many different platforms, programs can as a result<br />

work together over a network of different components, processors, subsystems, operating<br />

systems and communication protocols. MQSeries-programs use a consistent application<br />

interface (API) on all platforms. Figure 1 shows the main components of a MQSeries<br />

application.<br />

Figure a: MQSeries in Action<br />

1


tutor07.doc<br />

MQSeries enables the communication between different user-programs. Program A<br />

generates a message as available and writes its into a Queue. Program B reads this<br />

Message from the Queue and processes it.<br />

Both programs A and B use a special MQSeries Application program interface (API) in order<br />

to write messages into the Queue and/or to read out of the Queue. The MQ Series-API is<br />

named Message Queue interface (MQI).<br />

It is possible that program B is not running when program A places a message into the<br />

Queue. In this case, the Queue stores the message until program B is started and can<br />

retrieve it. On the other hand, program A can be inactive when program B retrieves the<br />

message out of the Queue. For MQSeries, it is not necessary that both communicating<br />

programs must be simultaneously active. MQSeries makes asynchronous processing<br />

possible.<br />

Before we start, some MQSeries objects and/or definitions must be explained.<br />

Message<br />

A message consists of two parts:<br />

- Data that are sent by one program to another.<br />

- A message descriptor or message header<br />

The message descriptor identifies the messages (with a message ID) and contains guiding<br />

information (attributes), as well as a message-type, time-flow, correlation-ID, priority and<br />

name of the answer queue.<br />

The message length is dependent on the version of MQ Series being used. MQSeries<br />

version 5 (for distributed platform) supports a maximal message-length of 100 MByte. On our<br />

OS/390 system at the University of Leipzig, MQSeries version 2.1 has been installed and<br />

supports messages up to 4 MByte.<br />

Queue Manager<br />

A Queue manager (QMGR) is the MQSeries software, that is assigned to a queue. It<br />

administers the objects belonging to MQSeries, especially Queues, Channels, process<br />

definitions, and others.<br />

In addition, the Queue manager makes the Message Queue Interface (MQI) available. An<br />

application the MQI to access queues and messages contained therein. The MQI<br />

implements a simple application program interface that is identical for all supported<br />

platforms. Through the MQI, the applications are separated from the Queue manager.<br />

An application must establish a communication with the Queue manager before it can access<br />

its resources. For this it uses the commands MQCONN or MQCONNX. If the application no<br />

longer requires a connection to the Queue manager, MQDISC is used to disconnect,<br />

In order to access a Queue, an application must first open this Queue. This is done by<br />

means of the MQOPEN call. With MQCLOSE, the Queue is closed again.<br />

With a queue opened, the application uses the command MQPUT in order to write a<br />

message into a Queue. With the call MQGET, a message can be read out of the Queue. By<br />

2


tutor07.doc<br />

means of the call MQPUT1, an application can, in one step, open a queue, write messages<br />

into the Queue and close the Queue again.<br />

Queue, Queue manager and processes are examples of MQSeries objects.<br />

When installating MQSeries on a server, the Queue manager must be setup by a systems<br />

programmer.<br />

The name of the Queue manager in our OS/390 MQSeries-installation is MQA1.<br />

Queue<br />

When an application writes a message into a Queue, the Queue manager will assure that the<br />

message is savely stored, recoverable and is delivered only once at the receiving end. This<br />

also applies if a message must be sent to a Queue of another Queue manager. This<br />

mechanism within the framework of MQSeries is called "secured delivery".<br />

There are persistent and non-persistent messages. Persistent messages are written in the<br />

MQSeries log and are available again after a new start of the QMGRs. Non-persistent<br />

messages are no longer available after a new start of the QMGRs.<br />

When an application opens a Queue, the Queue manager determines whether we are<br />

dealing with a "local Queue" or a "remote Queue". A local Queue is a queue that belongs to<br />

the Queue manager which interacts with the application. A Queue is named as "remote" if it<br />

belongs to another Queue manager.<br />

When an application issues the command MQPUT, the Queue manager writes the message<br />

to the local Queue. If it concerns a "remote" Queue, the Queue manager retrieves from its<br />

definition the information that is necessary for correct delivery (name of the remote QMGR,<br />

name of the remote Queue, name of the associated transmission Queue). The message is<br />

placed is into an inbetween-Queue (transmission Queue), and is assigned to the remote<br />

QMGR.<br />

Subsequently it is the task of the message Channel agent (MCA) to read the message of the<br />

transmission Queue and to send it over the network to a receiving MCA. The latter writes the<br />

message into the taget-Queue. After this the message in the transmission Queue is deleted.<br />

In our exercise, a local Queue must be set up first<br />

3


User Programs<br />

tutor07.doc<br />

Data exchange between two user-programs takes place via the MQI. The latter represents a<br />

call interface with a limited number of calls and extensive options for each call. Preset<br />

standard and start values guarantee a quick start.<br />

The MQI uses a set of structures and constants. With MQSeries, files and copybooks are<br />

included, that contain the definitions of these structures and their fields as well as the<br />

definitions of symbolic names, that are used for constants within the program logic.<br />

A program talks directly with its Queue manager. It resides on the same processor (or<br />

domain for clients) as the program itself.<br />

When the connection between a client and its server is interrupted, no API-Calls can be<br />

carried out because all objects are on the server.<br />

There exist a total of 13 APIs. They are listed in figure 20. The most important APIs<br />

are:MQCONN, MQOPEN, MQPUT, MQGET, MQCLOSE and MQDISC.<br />

Figure b: MQSeries APIs<br />

4


These are the individual APIs:<br />

tutor07.doc<br />

MQCONN establishes a connection with a Queue-manager with the help of standard links.<br />

MQCONNX: A connection with a Queue-manager over a fast path. Fastpath-PUTs and -<br />

GETs are faster; the application must however be well tested. The application and the<br />

Queue-manager run in the same process. If the application collapses, then the Queuemanager<br />

follows. This API-Call is new in MQSeries version 5.<br />

Version 5.<br />

MQBEGIN: starts a unit of work that is coordinated by the Queue-manager. It may contain<br />

external XA-Compatible-resource-managers. This API was introduced with MQSeries version<br />

5. It is used for the coordination of transactions, that use Queues (MQPUT and MQGET<br />

under syncpoint-conditions) and database-updates (SQL commands).<br />

MQPUT1: opens a Queue, transfers a message and closes the Queue again. This API-Call<br />

represents a combination of MQOPEN, MQPUT and MQCLOSE.<br />

MQINQ: Requests information over the Queue-manager or over one of its objects, like the<br />

number of messages in a Queue.<br />

MQSET: Changes some attributes of an object.<br />

MQCMIT: Indicates that a Syncpoint was reached. The messages are generated as part of a<br />

Unit of Work and are made available for other applications. Returned messages are deleted.<br />

MQBACK: Informs the Queue Manager about all returned PUT´s and GET´s messages<br />

since the last Syncpoint. Messages that were generates as part of a Unit of work are deleted.<br />

Returned messages are put on the Queue again.<br />

MQDISC: includes the transfer of a working unit: The termination of a program without<br />

interruption of the connection to the Queue-manager causes a "rollback" (MQBACK).<br />

In order to carry out this exercise, it is necessary that the Queue manager has been<br />

started. If this is not the case, an authorised user must start the Queue manager in<br />

SDSF SYSLOG. The command looks like this:<br />

Command Input === > / ! MQA1 START QMGR<br />

5


tutor07.doc<br />

For our exercise, the following tasks have to be performed:<br />

- Design local queue<br />

- Search for Module A (PUT) and B (GET)<br />

- Design Libraries PRAKTxx.MQA1.USERJCL, which contain the Members MQPUT and<br />

MQGET.<br />

- Rework members MQPUT and MQGET.<br />

- Execute MQGET and MQPUT.<br />

- Review result<br />

For the communication of the two user-programs a "local Queue" is required. In order to<br />

generate the latter, we select the "MQSeries for OS/390-Main Menu" of the Custompac<br />

master application Menu (CMAM). For this we select "m" as an option and press the Enterkey.<br />

CUSTOMPAC MASTER APPLICATION MENU<br />

OPTION ===> m SCROLL ===> PAGE<br />

IS ISMF - Interactive Storage Management Facility<br />

P PDF - ISPF/Program Development Facility<br />

ATC ATC - Application Testing Collection<br />

ART ARTT - Automated Regression Testing Tool<br />

DB2 DB2 - Perform DATABASE 2 interactive functions<br />

QMF QMF - QMF Query Management Facility<br />

C CPSM - CICSPlex/SM<br />

M MQ - MQSeries<br />

IP IPCS - Interactive Problem Control Facility<br />

OS SUPPORT - OS/390 ISPF System Support Options<br />

OU USER - OS/390 ISPF User Options<br />

SM SMP/E - SMP/E Dialogs<br />

SD SDSF - System Display and Search Facility<br />

R RACF - Resource Access Control Facility<br />

DI DITTO - Data Interfile Transfer, Testing and Operations<br />

HC HCD - Hardware Configuration Definition<br />

S SORT - DF/SORT Dialogs<br />

BMR BMR READ - BookManager Read (Read Online Documentation)<br />

F1=HELP F2=SPLIT F3=END F4=RETURN F5=RFIND F6=RCHANGE<br />

F7=UP F8=DOWN F9=SWAP F10=LEFT F11=RIGHT F12=RETRIEVE<br />

Figure 1: Screen of CMAM with selected option "m"<br />

As a result of our action, the Main Menu of MQSeries appears.<br />

6


IBM MQSeries for OS/390 - Main Menu<br />

Complete fields. Then press Enter.<br />

tutor07.doc<br />

Action . . . . . . . . 2 1. Display 5. Perform<br />

2. Define 6. Start<br />

3. Alter 7. Stop<br />

4. Delete<br />

Object type . . . . . QLOCAL +<br />

Name . . . . . . . . . PRAKT20<br />

Like . . . . . . . . . ________________________________________________<br />

Connect to queue<br />

manager . . . . . . :<br />

Target queue manager :<br />

Response wait time . : 30 seconds<br />

(C) Copyright IBM Corporation 1993,1999. All rights reserved.<br />

Command ===> __________________________________________________________________<br />

F1=Help F2=Split F3=Exit F4=Prompt F6=QueueMgr F9=Swap<br />

F10=Messages F12=Cancel<br />

Figure 2: MQSeries for OS/390 - Main Menu<br />

In the Main Menu, we enter in the line "Action" a 2 (Define). As an "Object type" and "name"<br />

we enter QLOCAL and/or PRAKTxx. All remaining entries remain as they are. A local Queue<br />

is defined with the name "PRAKTxx". The latter belongs to the Queue manager MQA1.<br />

Hint: If the error message "CSQO040I Object named PRAKT20 of type QUEUE already<br />

exists" appears, then a local Queue already exists with the name PRAKTxx. Please delete<br />

the old queue. Input a 4in the Panel "IBM MQSeries for OS/390 - Main Menu" in the line<br />

"Action". For "Object type" and "name" enter QLOCAL and PRAKTxx. Assure that both lines<br />

marked Queue Manager contain the entry "MQA1".<br />

Hitting the entry key three times deletes the Queue. The message: "CSQ9022I! MQA1<br />

CSQMUQLC ' DELETE QLOCAL' NORMALLY COMPLETION" confirms successful deletion.<br />

Use the F6 key in order to activate/access Menu changes in the fields "Connect to QMGR"<br />

and "Target QMGR" in the Menu.<br />

We enter 2 times “MQA1“ as a Queue manager. (See fig. 3)<br />

7


IBM MQSeries for OS/390 - Main Menu<br />

tutor07.doc<br />

Complete fields. Then press Enter.<br />

.-----------------------------------------------------------------------------.<br />

| Change the Queue Manager |<br />

| |<br />

| Make changes and press Enter. |<br />

| |<br />

| Connect to queue |<br />

| manager . . . . . . . MQA1 |<br />

| |<br />

| Target queue manager . MQA1 |<br />

| |<br />

| Response wait time . . 30 5 - 999 seconds |<br />

| |<br />

| |<br />

| F1=Help F2=Split F9=Swap F12=Cancel |<br />

'-----------------------------------------------------------------------------'<br />

(C) Copyright IBM Corporation 1993,1999. All rights reserved.<br />

Command ===> SYSID<br />

F1=Help F2=Split F3=Exit F4=Prompt F6=QueueMgr F9=Swap<br />

F10=Messages F12=Cancel<br />

Figure 3: “Change the Queue Manager”<br />

By hitting the Enter key these values are received. We should see a screen similar to Fig. 4<br />

IBM MQSeries for OS/390 - Main Menu<br />

Complete fields. Then press Enter.<br />

Action . . . . . . . . 2 1. Display 5. Perform<br />

2. Define 6. Start<br />

3. Alter 7. Stop<br />

4. Delete<br />

Object type . . . . . QLOCAL +<br />

Name . . . . . . . . . PRAKT20<br />

Like . . . . . . . . . ________________________________________________<br />

Connect to queue<br />

manager . . . . . . : MQA1<br />

Target queue manager : MQA1<br />

Response wait time . : 30 seconds<br />

(C) Copyright IBM Corporation 1993,1999. All rights reserved.<br />

Command ===> __________________________________________________________________<br />

F1=Help F2=Split F3=Exit F4=Prompt F6=QueueMgr F9=Swap<br />

F10=Messages F12=Cancel<br />

Figure 4: MQSeries Main Menu<br />

Subsequently hit the Enter-key. A further Screen appears as a result for the definition of the<br />

local Queue.<br />

8


Define a Local Queue<br />

tutor07.doc<br />

Complete fields, then press F8 for further fields, or Enter to define queue.<br />

More: +<br />

Queue name . . . . . . . . . PRAKT20<br />

Description . . . . . . . . . ________________________________<br />

________________________________<br />

Put enabled . . . . . . . . . Y Y=Yes,N=No<br />

Get enabled . . . . . . . . . Y Y=Yes,N=No<br />

Usage . . . . . . . . . . . . N N=Normal,X=XmitQ<br />

Storage class . . . . . . . . DEFAULT<br />

Command ===> __________________________________________________________________<br />

F1=Help F2=Split F3=Exit F7=Bkwd F8=Fwd F9=Swap<br />

F10=Messages F12=Cancel<br />

Figure 5: 2. Define Screen<br />

In this Screen, the name of the Queue must be registered (PRAKTxx) once more. To enable<br />

Put and Get, we select Y (Yes) for both. All other parameters are entered as shown in figure<br />

5.<br />

Subsequently we hit Key F8. The result is a 3 Define Screen (Fig.6) in which in the line<br />

"Default persistence" = "N" (No) is entered. A message is called "persistent" if it is still<br />

available after a restart of the Queue manager. It doesn’t matter whether the Queue manager<br />

was stopped by an operator command or stopped by a system error. This means that<br />

persistent messages are written into a protocol. If after an error a Queue manager is started<br />

again, it reproduces the messages from the protocol data.<br />

9


Define a Local Queue<br />

tutor07.doc<br />

Press F7 or F8 to see other fields, or Enter to define queue.<br />

More: - +<br />

Default persistence . . . . . N Y=Yes,N=No<br />

Default priority . . . . . . 0 0 - 9<br />

Message delivery sequence . . P P=Priority,F=FIFO<br />

Permit shared access . . . . N Y=Yes,N=No<br />

Default share option . . . . E E=Exclusive,S=Shared<br />

Index type . . . . . . . . . N N=None,M=MsgId,C=CorrelId,T=MsgToken<br />

Maximum queue depth . . . . . 999999999 0 - 999999999<br />

Maximum message length . . . 4194304 0 - 4194304<br />

Retention interval . . . . . 999999999 0 - 999999999 hours<br />

Cluster name . . . . . . . . ________________________________________________<br />

Cluster namelist name . . . . ________________________________________________<br />

Default bind . . . . . . . . O O=Open,N=Notfixed<br />

Command ===> __________________________________________________________________<br />

F1=Help F2=Split F3=Exit F7=Bkwd F8=Fwd F9=Swap<br />

F10=Messages F12=Cancel<br />

Figure 6: Input-Parameter im 2. Define Screen<br />

A message is considered "not-persistent" if it is no longer available after a restart of the<br />

Queue manager. We decide on a not-persistent message for our local Queue "PRAKTxx".<br />

The remaining parameters for the 3 Define Screen are entered as shown in Fig. 6<br />

Define a Local Queue<br />

Press F7 or F8 to see other fields, or Enter to define queue.<br />

Trigger Definition<br />

More: - +<br />

Trigger type . . . . . . . . F F=First,E=Every,D=Depth,N=None<br />

Trigger set . . . . . . . N Y=Yes,N=No<br />

Trigger message priority . 0 0 - 9<br />

Trigger depth . . . . . . 1 1 - 999999999<br />

Trigger data . . . . . . . ________________________________<br />

________________________________<br />

Process name . . . . . . . ________________________________________________<br />

Initiation queue . . . . . ________________________________________________<br />

Command ===> __________________________________________________________________<br />

F1=Help F2=Split F3=Exit F7=Bkwd F8=Fwd F9=Swap<br />

F10=Messages F12=Cancel<br />

Figure 7: 3. Define Screen<br />

Via F8 another three define screens can be called. We do not take advantage of this and hit<br />

in the 3 define screen.<br />

10


tutor07.doc<br />

As a result of this action, the Screen "display messages" appears. It shows whether the<br />

encountered definitions were successful for our local Queue "PRAKTxx" (fig. 7)<br />

Define a Local Queue<br />

Complete fields, then press F8 for further fields, or Enter to define queue.<br />

More: +<br />

Queue name . . . . . . . . . PRAKT20<br />

Description . . . . . . . . . ________________________________<br />

________________________________<br />

Put enabled . . . . . . . . . Y Y=Yes,N=No<br />

Get enabled . . . . . . . . . Y Y=Yes,N=No<br />

Usage . . . . . . . . . . . . N N=Normal,X=XmitQ<br />

Storage class . . . . . . . . DEFAULT<br />

CSQ9022I !MQA1 CSQMMSGP ' DEFINE QLOCAL' NORMAL COMPLETION<br />

Command ===> __________________________________________________________________<br />

F1=Help F2=Split F3=Exit F7=Bkwd F8=Fwd F9=Swap<br />

F10=Messages F12=Cancel<br />

Figure 8: Display messages<br />

As a result of this action, the Screen appears "display messages" that issues, whether the<br />

encountered definitions were successful for our local Queue "PRAKTxx" (fig. 8)<br />

IBM MQSeries for OS/390 - Main Menu<br />

Complete fields. Then press Enter.<br />

Action . . . . . . . . 1 1. Display 5. Perform<br />

2. Define 6. Start<br />

3. Alter 7. Stop<br />

4. Delete<br />

Object type . . . . . QLOCAL +<br />

Name . . . . . . . . . P*<br />

Like . . . . . . . . . ________________________________________________<br />

Connect to queue<br />

manager . . . . . . : MQA1<br />

Target queue manager : MQA1<br />

Response wait time . : 30 seconds<br />

(C) Copyright IBM Corporation 1993,1999. All rights reserved.<br />

Command ===> __________________________________________________________________<br />

F1=Help F2=Split F3=Exit F4=Prompt F6=QueueMgr F9=Swap<br />

F10=Messages F12=Cancel<br />

Figure 9: MQSeries Main Menu<br />

11


tutor07.doc<br />

This screen lists all local Queues with its definitions that begin with "P". With the key F11,<br />

important parameters of the local Queues can be displayed on the screens. The result is<br />

shown in figure 10.<br />

List Local Queues Row 1 of 1<br />

Type action codes. Then press Enter.<br />

1=Display 2=Define like 3=Alter 4=Delete<br />

Name Depth Get In Put Out<br />

_ PRAKT20 0 Y 0 Y 0<br />

******** End of list ********<br />

Command ===> __________________________________________________________________<br />

F1=Help F2=Split F3=Exit F5=Refresh F6=Clusinfo F7=Bkwd<br />

F8=Fwd F9=Swap F10=Messages F11=Attrs F12=Cancel<br />

Figure 10: List Local Queues<br />

Exercise: Set up a Local Queue with the name PRAKTxx (xx from your user ID) and check<br />

whether your Queue was implemented correctly or not.<br />

As the next step we generate the source code for the user-programs A and B in the<br />

programming language COBOL II. Because we do not presume, that the participant has any<br />

COBOL knowledge, we can simply copy the required source code for the programs A (PUT)<br />

and B (GET) from the IBM MQSeries library. It will be under the directory MQM.SCSQCOBS.<br />

The libraries already exist on the server in compiled form. In order to get an overview of both<br />

of the COBOL program modules, we do the following: In the Custompac master application<br />

Menu, we enter option P.3.4 and hit the enter key. As a result we obtain the Data List Utility<br />

(figure 11)<br />

12


tutor07.doc<br />

Menu RefList RefMode Utilities Help<br />

------------------------------------------------------------------------------<br />

Data Set List Utility<br />

blank Display data set list P Print data set list<br />

V Display VTOC information PV Print VTOC information<br />

Enter one or both of the parameters below:<br />

Dsname Level . . . MQM.SCSQCOBS<br />

Volume serial . .<br />

Data set list options<br />

Initial View . . . 2 1. Volume Enter "/" to select option<br />

2. Space / Confirm Data Set Delete<br />

3. Attrib / Confirm Member Delete<br />

4. Total<br />

When the data set list is displayed, enter either:<br />

"/" on the data set list command field for the command prompt pop-up,<br />

an ISPF line command, the name of a TSO command, CLIST, or REXX exec, or<br />

"=" to execute the previous command.<br />

Option ===><br />

F1=Help F3=Exit F10=Actions F12=Cancel<br />

Figure 11: Data Set List Utility<br />

In this Screen on the line "Dsname level" enter the PDS-name "MQM. SCSQCOBS". This<br />

library, together with MQM.SCSQCOBC forms an integral component of MQSeries . The first<br />

library contains among others the COBOL II-source program module for PUT and GET<br />

(.S -> source, while the second contains the copy book (...C ->Copy).<br />

In the line, “Initial View”, a "2" is entered (Space). Subsequently we hit the Enter-key. The<br />

following Screen “DSLIST- Data Sets Matching MQM.SCSQCOBS” displays the used<br />

storage space on a 3390-Device. (figure 12)<br />

13


tutor07.doc<br />

Menu Options View Utilities Compilers Help<br />

------------------------------------------------------------------------------<br />

DSLIST - Data Sets Matching MQM.SCSQCOBS Row 1 of 1<br />

Command - Enter "/" to select action Tracks %Used XT Device<br />

------------------------------------------------------------------------------b<br />

MQM.SCSQCOBS 44 84 1 3390<br />

***************************** End of Data Set list ****************************<br />

Command ===> Scroll ===> PAGE<br />

F1=Help F3=Exit F5=Rfind F12=Cancel<br />

Figure 12: DSLIST<br />

We enter a "b" (for browse) before the file names MQM. SCSQCOBS and hit the Enter- key.<br />

The result screen lists all members of this PDS as shown in Fig.11<br />

Menu Functions Confirm Utilities Help<br />

------------------------------------------------------------------------------<br />

BROWSE MQM.SCSQCOBS Row 00001 of 00023<br />

Name Prompt VV MM Changed Size Init Mod ID<br />

_________ CSQ4BVA1<br />

_________ CSQ4BVJ1<br />

s________ CSQ4BVK1<br />

_________ CSQ4CVB1<br />

_________ CSQ4CVB2<br />

_________ CSQ4CVB3<br />

_________ CSQ4CVB4<br />

_________ CSQ4CVB5<br />

_________ CSQ4CVC1<br />

_________ CSQ4CVD1<br />

_________ CSQ4CVD2<br />

_________ CSQ4CVD3<br />

_________ CSQ4CVD4<br />

_________ CSQ4CVD5<br />

_________ CSQ4CVJ1<br />

_________ CSQ4CVK1<br />

_________ CSQ4TVD1<br />

_________ CSQ4TVD2<br />

Command ===> Scroll ===> PAGE<br />

F1=Help F3=Exit F10=Actions F12=Cancel<br />

Figure 13: Member des PDS MQM.SCSQCOBS<br />

When you enter the command "S" (Select) on the line in front of the Member CSQ4BVK1, the<br />

source code of this module can be displayed (figure 12).<br />

With the keys F8 and F7 we can scroll forwards or backwards.<br />

14


tutor07.doc<br />

Menu Utilities Compilers Help<br />

-------------------------------------------------------------------------------<br />

BROWSE MQM.SCSQCOBS(CSQ4BVK1) Line 00000000 Col 001 080<br />

********************************* Top of Data **********************************<br />

CBL NODYNAM,LIB,OBJECT,RENT,RES,APOST<br />

* *<br />

* ------------------------------------------------------------- *<br />

IDENTIFICATION DIVISION.<br />

* ------------------------------------------------------------- *<br />

PROGRAM-ID. CSQ4BVK1.<br />

*REMARKS<br />

*****************************************************************<br />

* @START_COPYRIGHT@ *<br />

* Statement: Licensed Materials - Property of IBM *<br />

* *<br />

* 5655-A95 *<br />

* (C) Copyright IBM Corporation. 1993, 1998 *<br />

* *<br />

* Status: Version 2 Release 1 *<br />

* @END_COPYRIGHT@ *<br />

* *<br />

* Module Name : CSQ4BVK1 *<br />

Command ===> Scroll ===> PAGE<br />

F1=Help F3=Exit F5=Rfind F12=Cancel<br />

Figure 14: 1. Screen des Quellcodes von CSQ4BVK1<br />

By entering F3, one goes back into the list of members for MQM. SCSQCOBS. You can<br />

inspect the source code for the members CSQ4BVJ1 by means of the select command on<br />

the screen.<br />

We now need two JCL scripts in order to send a message to the message queue MQA1 and<br />

toreceive a message.<br />

Before we copy these two modules, we need to create a private library with the name<br />

PRAKTxx.MQA1.USERJCL. We do this as shown in <strong>Tutorial</strong> 1. Please enter the values as<br />

showm in figure 15:<br />

15


tutor07.doc<br />

Menu RefList Utilities Help<br />

------------------------------------------------------------------------------<br />

Allocate New Data Set<br />

More: +<br />

Data Set Name . . . : PRAKT20.MQA1.USERJCL<br />

Management class . . . DEFAULT (Blank for default management class)<br />

Storage class . . . . PRIM90 (Blank for default storage class)<br />

Volume serial . . . . SMS003 (Blank for system default volume) **<br />

Device type . . . . . (Generic unit or device address) **<br />

Data class . . . . . . (Blank for default data class)<br />

Space units . . . . . TRACK (BLKS, TRKS, CYLS, KB, MB, BYTES<br />

or RECORDS)<br />

Average record unit (M, K, or U)<br />

Primary quantity . . 3 (In above units)<br />

Secondary quantity 1 (In above units)<br />

Directory blocks . . 5 (Zero for sequential data set) *<br />

Record format . . . . FB<br />

Record length . . . . 80<br />

Block size . . . . . 6160<br />

Data set name type : PDS (LIBRARY, HFS, PDS, or blank) *<br />

(YY/MM/DD, YYYY/MM/DD<br />

Command ===><br />

F1=Help F3=Exit F10=Actions F12=Cancel<br />

Figure 15: Designing a New Data Set<br />

This PDS (partitioned data set) should receive the corresponding JCL-Script2 for the PUT<br />

and GET jobs. We copy from the PDS MQM.SCSQPROC the Member CSQ4BVJR. This<br />

member should be copied twice and named MQPUT and MQGET. We now have a JCL<br />

script with the Members MQPUT and MQGET. MQPUT contains the job, that through calling<br />

the module CSQ4BVK1 with the corresponding parameters (QMGR, QUEUE, MSGS, PAD,<br />

LEN and PERS) writes a message into the local Queue and displays the result on the<br />

screen. MQGET implements the job that reads this message through calling the module<br />

CSQ4BVJ1 with identical parameters (as MQPUT) from the local Queue and displays the<br />

results to the screen.<br />

The copying can be done (option P.3.3) by means of the Move/Copy Utility.<br />

16


tutor07.doc<br />

Menu RefList Utilities Help<br />

------------------------------------------------------------------------------<br />

Move/Copy Utility<br />

More: +<br />

C Copy data set or member(s) CP Copy and print<br />

M Move data set or member(s) MP Move and print<br />

L Copy and LMF lock member(s) LP Copy, LMF lock, and print<br />

P LMF Promote data set or member(s) PP LMF Promote and print<br />

Specify "From" Data Set below, then press Enter key<br />

From ISPF Library:<br />

Project . . . (--- Options C, CP, L, and LP only ----)<br />

Group . . . . . . . . . . . . .<br />

Type . . . .<br />

Member . . . (Blank or pattern for member list,<br />

"*" for all members)<br />

From Other Partitioned or Sequential Data Set:<br />

Data Set Name . . . 'MQM.SCSQPROC(CSQ4BVJR)'<br />

Volume Serial . . . (If not cataloged)<br />

Option ===> C<br />

F1=Help F3=Exit F10=Actions F12=Cancel<br />

Figure 16: Kopieren von CSQ4BVJR<br />

We input the values as indicated above, hit the Enter-key and arrive at the following Screen:<br />

Menu RefList Utilities Help<br />

------------------------------------------------------------------------------<br />

COPY From MQM.SCSQPROC(CSQ4BVJR)<br />

More: +<br />

Specify "To" Data Set Below<br />

To ISPF Library:<br />

Project . . PRAKT20 Replace option:<br />

Group . . . MQA1 Enter "/" to select option<br />

Type . . . . USERJCL Replace like-named members<br />

Member . . . MQGET (Blank unless member is to be renamed)<br />

To Other Partitioned or Sequential Data Set:<br />

Data Set Name . . .<br />

Volume Serial . . . (If not cataloged)<br />

Data Set Password . . (If password protected)<br />

To Data Set Options:<br />

Sequential Disposition Pack Option SCLM Setting<br />

1 1. Mod 3 1. Yes 3 1. SCLM<br />

2. Old 2. No 2. Non-SCLM<br />

Command ===><br />

F1=Help F3=Exit F10=Actions F12=Cancel<br />

Figure 17: Kopieren von CSQ4BVJR nach MQGET<br />

We copy the same Member once again, but now store it under<br />

PRAKTxx.MQA1.USERJCL.MQPUT<br />

17


tutor07.doc<br />

Exercise: Generate the new Dataset and copy the JCL scripts 2 times (as a MQGET and<br />

MQPUT).<br />

Now we edit the members MQPUT and MQGET. Both files are JCL scripts that must be<br />

adapted for our purposes: We open MQPUT by means of the TSO editor:<br />

File Edit Confirm Menu Utilities Compilers Test Help<br />

-------------------------------------------------------------------------------<br />

EDIT PRAKT20.MQA1.USERJCL(MQPUT) - 01.00 Columns 00001 00072<br />

****** ***************************** Top of Data ******************************<br />

==MSG> -Warning- The UNDO command is not available until you change<br />

==MSG> your edit profile using the command RECOVERY ON.<br />

==MSG> -CAUTION- Profile is set to STATS ON. Statistics did not exist for<br />

==MSG> this member, but will be generated if data is saved.<br />

000001 //******************************************************************<br />

000002 //* *<br />

000003 //* @START_COPYRIGHT@ *<br />

000004 //* Statement: Licensed Materials - Property of IBM *<br />

000005 //* *<br />

000006 //* 5655-A95 *<br />

000007 //* (C) Copyright IBM Corporation. 1993, 1998 *<br />

000008 //* *<br />

000009 //* Status: Version 2 Release 1 *<br />

000010 //* @END_COPYRIGHT@ *<br />

000011 //* *<br />

000012 //******************************************************************<br />

000013 //* CUSTOMIZE THIS JCL HERE FOR YOUR INSTALLATION<br />

000014 //* YOU MUST DO GLOBAL CHANGES ON THESE PARAMETERS USING YOUR EDITOR<br />

Command ===> Scroll ===> PAGE<br />

F1=Help F3=Exit F5=Rfind F6=Rchange F12=Cancel<br />

Figure 18: Source text MQPUT<br />

Using the F7 or F8 keys, we can display the source text by scrolling. You can see that the<br />

script has plenty of comments. (The actual script has only 8 lines).<br />

18


If we go to line 56:<br />

tutor07.doc<br />

File Edit Confirm Menu Utilities Compilers Test Help<br />

-------------------------------------------------------------------------------<br />

EDIT PRAKT20.MQA1.USERJCL(MQPUT) - 01.00 Columns 00001 00072<br />

000047 //* - FIRST PARM (++QMGR++) QUEUE MANAGER NAME<br />

000048 //* - SECOND PARM (++QUEUE++) QUEUE NAME<br />

000049 //* - THIRD PARM (++MSGS++) THE NUMBER OF MESSAGES TO GET-(9999)<br />

000050 //* - FOURTH PARM (++GET++) GET TYPE-(B)ROWSE/(D)ESTRUCTIVE<br />

000051 //* - FIFTH PARM (++SYNC++) (S)YNCPOINT/(N)O SYNCPOINT<br />

000052 //* MESSAGES ARE PRINTED TO DD SYSPRINT<br />

000053 //*<br />

000054 //*********************************************************************<br />

000055 //PUTMSGS EXEC PGM=CSQ4BVK1,REGION=1024K,<br />

000056 // PARM=('++QMGR++,++QUEUE++,++MSGS++,++PAD++,++LEN++,++PERS++')<br />

000057 //*GETMSGS EXEC PGM=CSQ4BVJ1,REGION=1024K,<br />

000058 //* PARM=('++QMGR++,++QUEUE++,++MSGS++,++GET++,++SYNC++')<br />

000059 //STEPLIB DD DSN=++USERLIB++,DISP=SHR<br />

000060 // DD DSN=++THLQUAL++.SCSQANL++LANGLETTER++,DISP=SHR<br />

000061 // DD DSN=++THLQUAL++.SCSQAUTH,DISP=SHR<br />

000062 //SYSDBOUT DD SYSOUT=*<br />

000063 //SYSABOUT DD SYSOUT=*<br />

000064 //SYSPRINT DD SYSOUT=*<br />

000065 //SYSOUT DD SYSOUT=*<br />

Command ===> Scroll ===> PAGE<br />

F1=Help F3=Exit F5=Rfind F6=Rchange F12=Cancel<br />

Figure 19: 2. Screen Quelltext MQPUT<br />

The parameters starting at line 56 are very well documented in the script. We replace this<br />

line by:<br />

File Edit Confirm Menu Utilities Compilers Test Help<br />

-------------------------------------------------------------------------------<br />

EDIT PRAKT20.MQA1.USERJCL(MQPUT) - 01.00 Columns 00001 00072<br />

000053 //*<br />

000054 //*********************************************************************<br />

000055 //PUTMSGS EXEC PGM=CSQ4BVK1,REGION=1024K,<br />

000056 // PARM=('MQA1,PRAKT20,3,Z,5,N')<br />

000057 //*PUTMSGS EXEC PGM=CSQ4BVK1,REGION=1024K,<br />

000058 //* PARM=('++QMGR++,++QUEUE++,++MSGS++,++PAD++,++LEN++,++PERS++')<br />

000059 //STEPLIB DD DSN=MQM.MQA1.USERLIB,DISP=SHR<br />

000060 // DD DSN=MQM.SCSQANLE,DISP=SHR<br />

000061 // DD DSN=MQM.SCSQAUTH,DISP=SHR<br />

000062 //SYSDBOUT DD SYSOUT=*<br />

000063 //SYSABOUT DD SYSOUT=*<br />

000064 //SYSPRINT DD SYSOUT=*<br />

****** **************************** Bottom of Data ****************************<br />

Command ===> sub Scroll ===> PAGE<br />

F1=Help F3=Exit F5=Rfind F6=Rchange F12=Cancel<br />

Figure 20: Neuer Quelltext MQPUT<br />

19


tutor07.doc<br />

This means: 3 messages are written into the local Queue whereby each messages consists<br />

of a sequence "ZZZZZ". After editing the parameters, we enter "SUB" on the command line.<br />

The command “SUB” is confirmed by means of “Enter” and the following screen appears:<br />

20


tutor07.doc<br />

File Edit Confirm Menu Utilities Compilers Test Help<br />

-------------------------------------------------------------------------------<br />

EDIT PRAKT20.MQA1.USERJCL(MQPUT) - 01.00 Columns 00001 00072<br />

000053 //*<br />

000054 //*********************************************************************<br />

000055 //PUTMSGS EXEC PGM=CSQ4BVK1,REGION=1024K,<br />

000056 // PARM=('MQA1,PRAKT20,3,Z,5,N')<br />

000057 //*GETMSGS EXEC PGM=CSQ4BVJ1,REGION=1024K,<br />

000058 //* PARM=('++QMGR++,++QUEUE++,++MSGS++,++GET++,++SYNC++')<br />

000059 //STEPLIB DD DSN=++USERLIB++,DISP=SHR<br />

000060 // DD DSN=++THLQUAL++.SCSQANL++LANGLETTER++,DISP=SHR<br />

000061 // DD DSN=++THLQUAL++.SCSQAUTH,DISP=SHR<br />

000062 //SYSDBOUT DD SYSOUT=*<br />

000063 //SYSABOUT DD SYSOUT=*<br />

000064 //SYSPRINT DD SYSOUT=*<br />

000065 //SYSOUT DD SYSOUT=*<br />

****** **************************** Bottom of Data ****************************<br />

P<br />

IKJ56700A ENTER JOBNAME CHARACTER(S) -<br />

Figure 21: „sub MQPUT“<br />

Here we can simply enter P (for Put). Background: the job gets a name that consists of the<br />

login (PRAKTxx) and the entered character (above). (Maximally 8 characters). So our job is<br />

named PRAKTxxP.<br />

We now get the following message:<br />

21


tutor07.doc<br />

File Edit Confirm Menu Utilities Compilers Test Help<br />

-------------------------------------------------------------------------------<br />

EDIT PRAKT20.MQA1.USERJCL(MQPUT) - 01.00 Columns 00001 00072<br />

000055 //PUTMSGS EXEC PGM=CSQ4BVK1,REGION=1024K,<br />

000056 // PARM=('MQA1,PRAKT20,3,Z,5,N')<br />

000057 //*GETMSGS EXEC PGM=CSQ4BVJ1,REGION=1024K,<br />

000058 //* PARM=('++QMGR++,++QUEUE++,++MSGS++,++GET++,++SYNC++')<br />

000059 //STEPLIB DD DSN=++USERLIB++,DISP=SHR<br />

000060 // DD DSN=++THLQUAL++.SCSQANL++LANGLETTER++,DISP=SHR<br />

000061 // DD DSN=++THLQUAL++.SCSQAUTH,DISP=SHR<br />

000062 //SYSDBOUT DD SYSOUT=*<br />

000063 //SYSABOUT DD SYSOUT=*<br />

000064 //SYSPRINT DD SYSOUT=*<br />

000065 //SYSOUT DD SYSOUT=*<br />

****** **************************** Bottom of Data ****************************<br />

IKJ56700A ENTER JOBNAME CHARACTER(S) -<br />

P<br />

IKJ56250I JOB PRAKT20P(JOB00829) SUBMITTED<br />

***<br />

Figure 22: 2. Screen „sub MQPUT“<br />

We press Enter, until a message is displayed on the screen:<br />

11.51.22 JOB00833 $HASP165 PRAKT20P ENDED AT N1 MAXCC=0 CN(INTERNAL)<br />

***<br />

Figure 23: Ausgabe von „sub MQPUT“<br />

This wrote our messages into the local Queue.<br />

22


tutor07.doc<br />

Now these messages must be retrieved. We edit the Member MQGET from the directory<br />

PRAKTxx.MQA1.USERJCL.<br />

It is the same JCL script as for MQGET. We scroll with F8 directly to line 56 and replace the<br />

line with:<br />

23


tutor07.doc<br />

File Edit Confirm Menu Utilities Compilers Test Help<br />

-------------------------------------------------------------------------------<br />

EDIT PRAKT20.MQA1.USERJCL(MQGET) - 01.00 Columns 00001 00072<br />

000053 //*<br />

000054 //*********************************************************************<br />

000055 //*PUTMSGS EXEC PGM=CSQ4BVK1,REGION=1024K,<br />

000056 //* PARM=('++QMGR++,++QUEUE++,++MSGS++,++PAD++,++LEN++,++PERS++')<br />

000057 //GETMSGS EXEC PGM=CSQ4BVJ1,REGION=1024K,<br />

000058 // PARM=('MQA1,PRAKT20,3,D,N')<br />

000059 //STEPLIB DD DSN=MQM.MQA1.USERLIB,DISP=SHR<br />

000060 // DD DSN=MQM.SCSQANLE,DISP=SHR<br />

000061 // DD DSN=MQM.SCSQAUTH,DISP=SHR<br />

000062 //SYSDBOUT DD SYSOUT=*<br />

000063 //SYSABOUT DD SYSOUT=*<br />

000064 //SYSPRINT DD SYSOUT=*<br />

000065 //SYSOUT DD SYSOUT=*<br />

****** **************************** Bottom of Data ****************************<br />

Command ===> sub Scroll ===> PAGE<br />

F1=Help F3=Exit F5=Rfind F6=Rchange F12=Cancel<br />

Figure 24: Neuer Quelltext von MQGET<br />

By entering “sub“ we run the script. The jobname should now be PRAKTxxG, therefore enter<br />

a “G”.<br />

Exercise: Repeat the scripts MQPUT and after that MQGET again.<br />

After a successful run, we may ask ourselves, what has actually happened:<br />

After repeatedly hitting the F3key, we arrive back at the Custompac master application<br />

Menu. Subsequently we enter on the line "option" SD and arrive therewith into the SDSF<br />

panel.<br />

24


tutor07.doc<br />

Display Filter View Print Options Help<br />

-------------------------------------------------------------------------------<br />

HQX1900------------------ SDSF PRIMARY OPTION MENU --------------------------<br />

DA - Display active users in the sysplex<br />

I - Display jobs in the JES2 input queue<br />

O - Display jobs in the JES2 output queue<br />

H - Display jobs in the JES2 held output queue<br />

ST - Display status of jobs in the JES2 queues<br />

SE - Display scheduling environments in the MAS or sysplex<br />

END - Exit SDSF<br />

Licensed Materials - Property of IBM<br />

5647-A01 (C) Copyright IBM Corp. 1981, 1997. All rights reserved.<br />

US Government Users Restricted Rights - Use, duplication or<br />

disclosure restricted by GSA ADP Schedule Contract with IBM Corp.<br />

COMMAND INPUT ===> st SCROLL ===> PAGE<br />

F1=HELP F2=SPLIT F3=END F4=RETURN F5=IFIND F6=BOOK<br />

F7=UP F8=DOWN F9=SWAP F10=LEFT F11=RIGHT F12=RETRIEVE<br />

Figure 25: SDSF Primary Option Menu<br />

Enter “ST“ (status) on the command line. Confirm your action by pressing “Enter”<br />

Display Filter View Print Options Help<br />

-------------------------------------------------------------------------------<br />

SDSF STATUS DISPLAY ALL CLASSES LINE 1-9 (9)<br />

NP JOBNAME JOBID OWNER PRTY QUEUE C POS SAFF ASYS STATUS<br />

PRAKT20 TSU00826 PRAKT20 15 EXECUTION SYS1 SYS1<br />

S PRAKT20P JOB00837 PRAKT20 1 PRINT A 1106<br />

PRAKT20G JOB00838 PRAKT20 1 PRINT A 1107<br />

COMMAND INPUT ===> SCROLL ===> PAGE<br />

F1=HELP F2=SPLIT F3=END F4=RETURN F5=IFIND F6=BOOK<br />

F7=UP F8=DOWN F9=SWAP F10=LEFT F11=RIGHT F12=RETRIEVE<br />

Figure 26: SDSF Status Display All Classes<br />

On the line of the job-number, we input a S (Select) and confirm with Enter. Now our script is<br />

displayed; we scroll to the results at the end:<br />

25


tutor07.doc<br />

Display Filter View Print Options Help<br />

-------------------------------------------------------------------------------<br />

SDSF OUTPUT DISPLAY PRAKT20P JOB00839 DSID 4 LINE 20 COLUMNS 02- 81<br />

COMMAND INPUT ===> SCROLL ===> PAGE<br />

IEF374I STEP/PUTMSGS /STOP 2002093.1214 CPU 0MIN 00.15SEC SRB 0MIN 00.01S<br />

IEF375I JOB/PRAKT20P/START 2002093.1214<br />

IEF376I JOB/PRAKT20P/STOP 2002093.1214 CPU 0MIN 00.15SEC SRB 0MIN 00.01S<br />

===========================================<br />

PARAMETERS PASSED :<br />

QMGR - MQA1<br />

QNAME - PRAKT20<br />

NUMMSGS - 000000003<br />

PADCHAR - Z<br />

MSGLENGTH - 000000005<br />

PERSISTENCE - N<br />

===========================================<br />

MQCONN SUCCESSFUL<br />

MQOPEN SUCCESSFUL<br />

000000003 MESSAGES PUT TO QUEUE<br />

MQCLOSE SUCCESSFUL<br />

MQDISC SUCCESSFUL<br />

******************************** BOTTOM OF DATA ********************************<br />

F1=HELP F2=SPLIT F3=END F4=RETURN F5=IFIND F6=BOOK<br />

F7=UP F8=DOWN F9=SWAP F10=LEFT F11=RIGHT F12=RETRIEVE<br />

Figure 27: SDSF Output Display Job von MQPUT<br />

Here we see what the script actually did, a MQCONN, MQOPEN, three messages created,<br />

MQCLOSE and MQDISC. We go back with F3 and observe the result of PRAKTxxG.<br />

Display Filter View Print Options Help<br />

-------------------------------------------------------------------------------<br />

SDSF OUTPUT DISPLAY PRAKT20G JOB00838 DSID 4 LINE 24 COLUMNS 02- 81<br />

COMMAND INPUT ===> SCROLL ===> PAGE<br />

IEF376I JOB/PRAKT20G/STOP 2002093.1204 CPU 0MIN 00.15SEC SRB 0MIN 00.01S<br />

===========================================<br />

PARAMETERS PASSED :<br />

QMGR - MQA1<br />

QNAME - PRAKT20<br />

NUMMSGS - 000000003<br />

GET - D<br />

SYNCPOINT - N<br />

===========================================<br />

MQCONN SUCCESSFUL<br />

MQOPEN SUCCESSFUL<br />

000000000 : 000000005 : ZZZZZ<br />

000000001 : 000000005 : ZZZZZ<br />

000000002 : 000000005 : ZZZZZ<br />

000000003 MESSAGES GOT FROM QUEUE<br />

MQCLOSE SUCCESSFUL<br />

MQDISC SUCCESSFUL<br />

******************************** BOTTOM OF DATA ********************************<br />

F1=HELP F2=SPLIT F3=END F4=RETURN F5=IFIND F6=BOOK<br />

F7=UP F8=DOWN F9=SWAP F10=LEFT F11=RIGHT F12=RETRIEVE<br />

Here our 3 messages were retrieved again.<br />

Figure 28: SDSF Output Display Job of MQGET<br />

26


tutor07.doc<br />

Exercise: Work on these tasks and send a print dump of the<br />

Screens 27 and 28 in bitmap or JPEG format (each figure must not exceed<br />

250 Kbyte in size) to the Mail address of your teacher/tutor.<br />

27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!