基本配置
zOS v1.10 基本配置可以先参考下面教程
ubuntu 编译 hercules 主机安装 z/OS 教程
zOS MQ 版本为 CSQ700
Windows 11 IBM MQ 版本为最新 9.x
IBM MQ 官网有开发者版本可以免费下载,档名如下
mqadv_dev931_windows.zip (全名为 IBM MQ Advanced for Developers)
另外,可以下载 IBM MQ Explorer,GUI 介面工具用来管理 MQ
9.3.1.0-IBM-MQ-Explorer-Win64.zip
注意: MQ 要用完整的版本,而不是 IBM MQ Client,Client 版本不能建立本地 MQ Manager
目标是配置成 DATACOM 这个支援主从双向架构
架构基础类似 IBM 红书的下面例子
WebSphere MQ Primer: An Introduction to Messaging and WebSphere MQ
MQ IP 和 端口
系統 A: Windows 11 192.158.50.17:1414
MQ Manager PLS1
系統 B: zOS 192.168.200.1:1416
MQ Manager CSQ7
详细步骤
Windows 11 先安装 IBM MQ Advanced for Developers 和 IBM MQ Explorer
预设会有一个 实体 Installation1
Windows 防火墙添加 1414 接入允许
将当前用户加到 mqm 用户组
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\WINDOWS\system32> Get-LocalGroupMember -Name "mqm"
ObjectClass Name PrincipalSource
----------- ---- ---------------
User LAPTOP-HSBBFRC7\kazuya Local
User LAPTOP-HSBBFRC7\MUSR_MQADMIN Local
PS C:\WINDOWS\system32>
zOS 查看 MQ Jobname,da all
CSQ7MSTR,CSQ7CHIN
查看 CHANNEL 配置 CSQ4INPX
VIEW ADCD.Z110.PROCLIB(CSQ7CHIN) - 01.00 Columns 00001 00080
Command ===> Scroll ===> CSR
000097 //******************************************************************
000098 //* SYSTEM INITIALIZATION INPUT DATA SETS *
000099 //* *
000100 //* This sample shows the IBM supplied samples being used for the *
000101 //* initialization input data sets. These data sets *
000102 //* should be copied into a user library and tailored. *
000103 //******************************************************************
000104 //CSQINPX DD DSN=CSQ700.CSQ7.SCSQPROC(CSQ4INPX),DISP=SHR
000105 //*
000106 //******************************************************************
000107 //* USER EXIT LIBRARY *
000108 //******************************************************************
查看 CSQ4INPX 找出 LISTENER 的端口 1416
VIEW CSQ700.CSQ7.SCSQPROC(CSQ4INPX) - 01.06 Columns 00001 00080
Command ===> Scroll ===> CSR
000043 *****************************************************************
000044 * Start Listeners
000045 *****************************************************************
000046 *
000047 * You must start a listener for each communications protocol that
000048 * you use.
000049 *
000050 ******
000051 START LISTENER TRPTYPE( TCP ) PORT(1416)
000052 * START LISTENER
000053
000054 * START LISTENER TRPTYPE( LU62 ) LUNAME( ++LOCALluname++ )
如果修改了配置,要重起 MQ Manager 和 Channel Listener
在 console 使用 d opdata 查看 CSQ 指令前置为 %CSQ7
File Options Keypad
- started
- 21.19.28 STC00026 IEF404I BPXAS - ENDED - TIME=21.19.28
- 21.19.28 STC00024 IEF404I BPXAS - ENDED - TIME=21.19.28
- 21.19.28 STC00025 IEF404I BPXAS - ENDED - TIME=21.19.28
- 21.19.28 STC00042 IEF404I BPXAS - ENDED - TIME=21.19.28
- 21.19.28 STC00041 IEF404I BPXAS - ENDED - TIME=21.19.28
- 21.21.52 STC00043 +CSQX202E %CSQ7 CSQXRCTL Connection or remote listener
- unavailable,
- channel CAMQTS.HB.WRKLD03,
- connection (192.168.50.17)
- TRPTYPE=TCP RC=00000467 (ETIMEDOUT) reason=00000000
- 21.21.52 STC00043 +CSQX599E %CSQ7 CSQXRCTL Channel CAMQTS.HB.WRKLD03
- ended abnormally
- 21.23.10 TSU00044 $HASP373 IBMUSER STARTED
- 21.33.10 STC00043 +CSQX500I %CSQ7 CSQXRESP Channel CAMQTS.HA.WRKLD03
- started
- 21.39.47 STC00043 +CSQX500I %CSQ7 CSQXRCTL Channel CAMQTS.HB.WRKLD03
- started
21.47.53 IWM063I WLM POLICY WAS REFRESHED DUE TO A PROCESSOR
SPEED CHANGE
- 21.50.47 STC00043 +CSQX004I %CSQ7 CSQXSPRM Channel initiator is using 30
- MB of local
- storage, 1532 MB are free
- 22.04.01 TSU00045 $HASP373 IBMUSER STARTED
- 22.04.45 TSU00046 $HASP373 IBMUSER STARTED
- 22.20.06 TSU00047 $HASP373 IBMUSER STARTED
- 22.29.07 d opdata
- 22.29.12 D A,L
00- 22.29.17 d opdata
IEE603I 22.29.17 OPDATA DISPLAY FRAME LAST F E SYS=ADCD
PREFIX OWNER SYSTEM SCOPE REMOVE FAILDSP
$ JES2 ADCD SYSTEM NO SYSPURGE
-DB9G DB9GMSTR ADCD SYSTEM NO SYSPURGE
%CSQ7 CSQ7 ADCD SYSTEM NO PURGE
REXX1A AXR ADCD SYSTEM NO PURGE
IEE612I CN=L700 DEVNUM=0700 SYS=ADCD
IEE163I MODE= RD
重起指令
%CSQ7 STOP CHINIT
%CSQ7 STOP QMGR MODE=FORCE
%CSQ7 START QMGR
%CSQ7 START CHINIT
注意: 如果是已经 DEFINE 定义的 QUEUE 或 CHANNEL,重起也还会在的,要手动 DELETE 才行
在 CSQ7MSTR 里定义新的 CSQ4MTM1
VIEW ADCD.Z110.PROCLIB(CSQ7MSTR) - 01.02 Columns 00001 00080
Command ===> Scroll ===> CSR
000091 //******************************************************************
000092 //BSDS1 DD DSN=CSQ700.CSQ7.BSDS01,DISP=SHR
000093 //BSDS2 DD DSN=CSQ700.CSQ7.BSDS02,DISP=SHR
000094 //*
000095 //******************************************************************
000096 //* SYSTEM INITIALIZATION INPUT FILES *
000097 //* *
000098 //* This sample shows the IBM supplied samples being used for the *
000099 //* initialization input data sets. These data sets *
000100 //* should be copied into a user library and tailored. *
000101 //******************************************************************
000102 //CSQINP1 DD DSN=CSQ700.CSQ7.SCSQPROC(CSQ4INP1),DISP=SHR
000103 //CSQINP2 DD DSN=CSQ700.CSQ7.SCSQPROC(CSQ4INSG),DISP=SHR
000104 // DD DSN=CSQ700.CSQ7.SCSQPROC(CSQ4INSX),DISP=SHR
000105 // DD DSN=CSQ700.CSQ7.SCSQPROC(CSQ4INSS),DISP=SHR
- - - - - - - - - - - - - - - - - - - - - 13 Line(s) not Displayed
000119 // DD DSN=CSQ700.CSQ7.SCSQPROC(CSQ4MTM1),DISP=SHR
000120 //* DD DSN=CSQ700.CSQ7.SCSQPROC(CSQ4WRK),DISP=SHR
000121 // DD DSN=CSQ700.CSQ7.SCSQPROC(CSQ4DISP),DISP=SHR
000122 //CSQOUT1 DD SYSOUT=*
000123 //CSQOUT2 DD SYSOUT=*
000124 //*
定义 x1 Tranmission Queue,x2 Local Queue,x2 Remote Queue
VIEW CSQ700.CSQ7.SCSQPROC(CSQ4MTM1) - 01.10 Columns 00001 00080
Command ===> Scroll ===> CSR
****** ********************************* Top of Data **********************************
000001 DEFINE QLOCAL( 'CAMQTS.XQ.WRKLD03' ) +
- - - - - - - - - - - - - - - - - - - - - 35 Line(s) not Displayed
000037
000038 DEFINE CHANNEL( 'CAMQTS.HB.WRKLD03' ) +
000039 QSGDISP( QMGR ) +
000040 CHLTYPE( SDR ) +
- - - - - - - - - - - - - - - - - - - - - 21 Line(s) not Displayed
000062 CONNAME( '192.168.50.17(1414)')
000063
000064 DEFINE CHANNEL( 'CAMQTS.HA.WRKLD03' ) +
000065 QSGDISP( QMGR ) +
000066 CHLTYPE( RCVR ) +
- - - - - - - - - - - - - - - - - - - - - 19 Line(s) not Displayed
000086
000087 DEFINE QLOCAL( 'CAMQTS.SID.WRKLD03' ) +
- - - - - - - - - - - - - - - - - - - - - 35 Line(s) not Displayed
000123
000124 DEFINE QREMOTE( 'CAMQTS.SOD.WRKLD03' ) +
- - - - - - - - - - - - - - - - - - - - - - 6 Line(s) not Displayed
000131 RNAME( 'CAMQTS.TID.WRKLD03' ) +
000132 RQMNAME( PLS1 ) +
000133 XMITQ( 'CAMQTS.XQ.WRKLD03' )
000134
000135 DEFINE QREMOTE( 'CAMQTS.TOD.WRKLD03' ) +
- - - - - - - - - - - - - - - - - - - - - - 6 Line(s) not Displayed
000142 RNAME( 'CAMQTS.SID.WRKLD03' ) +
000143 RQMNAME( PLS1 ) +
000144 XMITQ( 'CAMQTS.XQ.WRKLD03' )
000145
000146 DEFINE QLOCAL( 'CAMQTS.TID.WRKLD03' ) +
- - - - - - - - - - - - - - - - - - - - - 35 Line(s) not Displayed
****** ******************************** Bottom of Data ********************************
在 Windows 11 IBM MQ Explorer 定义相对应的 MQ Manager PLS1
定义 Queue
定义 Channel
确定 Windows MQ 的 Listener 端口 1414
成功起动 zOS CSQ 和 Windows MQ 后,状态为 Running
測試
在 Windows MQ Explorer,对 Remote Queue Put test message Test123454321
使用 zOS 自带的 12 MQ 程序查看 MQ 当前 Queue Depth
12 MQ WMQ Series Operations and Control
输入 Action 1,Object type: QUEUE, Target queue manager: CSQ7
. IBM WebSphere MQ for z/OS - Main Menu .
. .
. Complete fields. Then press Enter. .
. .
. Action . . . . . . . . . . 1 0. List with filter 4. Manage .
. 1. List or Display 5. Perform .
. 2. Define like 6. Start .
. 3. Alter 7. Stop .
. 8. Command .
. Object type . . . . . . . . QUEUE + .
. Name . . . . . . . . . . . * .
. Disposition . . . . . . . . Q=Qmgr, C=Copy, P=Private, G=Group, .
. S=Shared, A=All .
. .
. Connect name . . . . . . . CSQ7 - local queue manager or group .
. Target queue manager . . . CSQ7 .
. - connected or remote queue manager for command input .
. Action queue manager . . . CSQ7 - command scope in group .
. Response wait time . . . . 30 5 - 999 seconds .
. .
. (C) Copyright IBM Corporation 1993,2007. All rights reserved. .
在 Windows MQ 相对应的 zOS Remote Queue 前 输入1
. List Queues - CSQ7 Row 1 of 42
.
. Type action codes, then press Enter. Press F11 to display queue status.
. 1=Display 2=Define like 3=Alter 4=Manage
.
.
. Name Type Disposition
. <> * QUEUE PRIVATE CSQ7
. CAMQTS.SID.WRKLD03 QLOCAL QMGR CSQ7
. CAMQTS.SOD.WRKLD03 QREMOTE QMGR CSQ7
. 1 CAMQTS.TID.WRKLD03 QLOCAL QMGR CSQ7
. CAMQTS.TOD.WRKLD03 QREMOTE QMGR CSQ7
. CAMQTS.XQ.WRKLD03 QLOCAL QMGR CSQ7
. CICSA.INITQ QLOCAL QMGR CSQ7
Current queue depth 为 1 显示有 1 个 MQ Message
CSQ700.SCSQCLST,CSQ700.SCSQCOBS 自带很多 MQ 程序,例如 CSQ4RCH1
VIEW CSQ700.SCSQCLST(CSQ4RCH1) - 01.00 Columns 00001 00080
Command ===> Scroll ===> CSR
000044 ISPEXEC LIBDEF ISPLLIB DATASET ID('++USER.LOAD++')
000045 ISPEXEC LIBDEF ISPPLIB DATASET ID('++THLQUAL++.SCSQPNLA')
000046 ISPEXEC LIBDEF ISPMLIB DATASET ID('++THLQUAL++.SCSQMSGE')
000047
000048 /*********************************/
000049 /* ISPF variable initialization */
000050 /*********************************/
000051
000052 SET USERID = &SYSUID
000053 ISPEXEC VPUT (USERID) SHARED
000054
000055 /********************************************************************/
000056 /* Call CSQ4TCH1 to start the message handler sample. */
000057 /* For COBOL version call CSQ4TVH1. */
000058 /********************************************************************/
000059 ISPEXEC SELECT PGM(CSQ4TCH1)
000060
000061 END
****** ******************************** Bottom of Data ********************************
复例一套到自己的 LIBRARY,然后,修改相对应路径,这里使用 CSQ4RCH1 去调 CSQ4TVH1
VIEW MTMAPRD.BATCH.CLIST(CSQ4RCH1) - 01.09 Columns 00001 00080
Command ===> Scroll ===> CSR
000056 /****************************/
000057 /* LIBDEFS */
000058 /****************************/
000059
000060 ISPEXEC LIBDEF ISPLLIB DATASET ID('CSQ700.SCSQAUTH' +
000061 'MTMAPRD.BATCH.LOAD' +
000062 'CSQ700.SCSQLOAD')
000063
000064 ISPEXEC LIBDEF ISPPLIB DATASET ID('MA17.ISPPENU' +
000065 'CSQ700.SCSQPNLE')
000066
000067 ISPEXEC LIBDEF ISPMLIB DATASET ID('CSQ700.SCSQMSGE')
000068
000069 /*********************************/
000070 /* ISPF variable initialization */
000071 /*********************************/
000072
000073 SET USERID = &SYSUID
000074 ISPEXEC VPUT (USERID) SHARED
000075
000076 SET QMGR = UNDEFINED
000077 ISPEXEC VPUT (QMGR) SHARED
000078
000079 /********************************************************************/
000080 /* Call CSQ4TCH1 to start the message handler sample. */
000081 /* For COBOL version call CSQ4TVH1. */
000082 /********************************************************************/
000083 ISPEXEC SELECT PGM(CSQ4TVH1)
000084
000085 END
****** ******************************** Bottom of Data ********************************
输入 ex 或 tso exec 'MTMAPRD.BATCH.CLIST(CSQ4RCH1)'
VIEW MTMAPRD.BATCH.CLIST Row 00001 of 00001
Command ===> Scroll ===> CSR
Name Prompt Size Created Changed ID
ex_______ CSQ4RCH1 85 1996/01/16 2022/12/27 16:37:20 IBMUSER
在版面输入 CSQ7 和 CAMQTS.TID.WRKLD03
显示有 1 个 MQ Message
. ---------------------- Websphere MQ for z/OS - Samples ------- Row 1 to 1 of 1 .
. COMMAND ==> .
. .
. Queue Manager : CSQ7 : .
. Queue : CAMQTS.TID.WRKLD03 : .
. .
. Message number 01 of 01 .
. .
. Msg Put Date Put Time Format User Put Application .
. No MM/DD/YY HH:MM:SS Name Identifier Type Name .
. 01 12/30/20 15:06:53 MQSTR KAZUYA 00000011 MQ Explorer 9.3.1 .
. ******************************* Bottom of data ******************************** .
注意: 这里显示的 Timestamp 有点差别,后期再处理
可以使用 F Action 去转发 MQ Message
---------------------- Websphere MQ for z/OS - Samples ----- Row 1 to 29 of 29
COMMAND ==>
Queue Manager : CSQ7 :
Queue : CAMQTS.TID.WRKLD03 :
Forward to Q Mgr : CSQ7 :
Forward to Queue : CAMQTS.SOD.WRKLD03 :
Action : : (D)elete (F)orward
Message Content :
-------------------------------------------------------------------------------
Message Descriptor
StrucId : `MD `
Version : 000000001
Report : 000000000
MsgType : 000000008
Expiry : -00000001
Feedback : 000000000
Encoding : 000000546
CodedCharSetId : 000001208
Format : `MQSTR `
Priority : 000000000
Persistence : 000000000
MsgId : `414D5120504C5331202020202020202086E8AE63012C0140`X
CorrelId : `000000000000000000000000000000000000000000000000`X
BackoutCount : 000000000
ReplyToQ : ` `
ReplyToQMgr : `PLS1 `
UserIdentifier : `KAZUYA `
AccountingToken :
`1601051500000024E90379E4FF5A71F7FB6271EA03000000000000000000000B`X
ApplIdentityData : ` `
PutApplType : 000000011
PutApplName : `MQ Explorer 9.3.1 `
PutDate : `20221230`
PutTime : `15065365`
ApplOriginData : ` `
Message Buffer : 13 byte(s)
00000000 : 5465 7374 3132 3334 3534 3332 31 `............. `
******************************* Bottom of data ********************************
转发到 CAMQTS.SOD.WRKLD03 (Remote Queue)
. ---------------------- Websphere MQ for z/OS - Samples ----- Row 1 to 29 of 29
. COMMAND ==>
.
. Queue Manager : CSQ7 :
. Queue : CAMQTS.TID.WRKLD03 :
. Forward to Q Mgr : CSQ7 :
. Forward to Queue : CAMQTS.SOD.WRKLD03 :
.
. Action : F : (D)elete (F)orward
.
. Message Content :
. -------------------------------------------------------------------------------
Message has been forwarded.
到 Windows IBM MQ Explorer
使用 Browse Message 查看 MQ Message Data
再次查看 queue depth 显示没有 Message