免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7952 | 回复: 7
打印 上一主题 下一主题

问高手,谁知道as400上的mq的例子程序 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-05-25 10:38 |只看该作者 |倒序浏览
as400上的mq例子程序qmqmsamp中的qrpglesrc中的amq2put4编译之后,调用时怎么总是:
Sample AMQ2PUT4 start                                               
Target queue is REQ1                             MQM400            
Target queue manager is MQM400                           RCMBRTXT   
MQCONN ended with reason code   000002058                           
  Unable to connect to queue manager                                 
我的队列管理器MQM400用c语言调是可以的啊,队列REQ1也是可以put的,不知道这个例子程序怎么回事,是ibm错误还是编译有问题呢?希望高手踊跃回答啊。

论坛徽章:
0
2 [报告]
发表于 2004-05-25 11:52 |只看该作者

问高手,谁知道as400上的mq的例子程序

MQRC_Q_MGR_NAME_ERROR
(2058, X'80A') Queue manager name not valid or not known.

论坛徽章:
0
3 [报告]
发表于 2004-05-25 11:53 |只看该作者

问高手,谁知道as400上的mq的例子程序

一般来讲是环境或配置上的小问题.  你先查查2058的原因, 再看看当时是否只有一个队列管理器是活动的, 活动的队列管理器是否是确省的队列管理器.  我记得早期版本RPG连接队列管理器时不需指定名字.

论坛徽章:
0
4 [报告]
发表于 2004-05-25 16:25 |只看该作者

问高手,谁知道as400上的mq的例子程序

这个我明白的,2058就是队列管理器的问题,MQM400是默认的队列管理器,并且是启动的,因为我的6000都在连着用呢,所以不知道为什么老报这个错。它是一个例子程序,按理说应该不会有问题的。还有,它怎么打出的结果的第二行会是is REQ1 MQM400 ,连队列管理器名也打出来了。我用在参数中不输队列管理器名,但是还是一样,它自动找到MQM400并打出相同的信息。唉,不知道怎么回事了。

论坛徽章:
0
5 [报告]
发表于 2004-05-26 09:11 |只看该作者

问高手,谁知道as400上的mq的例子程序

MQM400 RCMBRTXT

应该是程序中赋值的问题。  不行你把程序贴出来我看看能不能找出原因。

论坛徽章:
0
6 [报告]
发表于 2004-05-26 11:23 |只看该作者

问高手,谁知道as400上的mq的例子程序

多谢老兄,这是它的源代码:
     H
      ****************************************************************
      *                                                              *
      * Program name: AMQ3PUT4                                       *
      *                                                              *
      * Description: Sample ILE RPG program that puts messages to    *
      *              a message queue (example using MQPUT)           *
      *                                                              *
      *<START_COPYRIGHT>;                                             *
      * Licensed Materials - Property of IBM                         *
      *                                                              *
      * 5724-B41                                                     *
      * (C) Copyright IBM Corp. 1994, 2002 All Rights Reserved.      *
      *                                                              *
      * US Government Users Restricted Rights - Use, duplication or  *
      * disclosure restricted by GSA ADP Schedule Contract with      *
      * IBM Corp.                                                    *
      *<END_COPYRIGHT>;                                               *
      *                                                              *
      ****************************************************************
      *                                                              *
      * Function:                                                    *
      *                                                              *
      *                                                              *
      *   AMQ3PUT4 is a sample RPG program to put messages on a      *
      *   message queue, and is an example of the use of MQPUT.      *
      *                                                              *
      *      -- sample input is taken from an array defined in       *
      *         the source; the program parameter identifies         *
      *         the target queue                                     *
      *                                                              *
      *      -- adds each text line in the array to the message      *
      *         queue, taking each line of text as the content       *
      *         of a datagram message                                *
      *                                                              *
      *      -- writes a message for each MQI reason other than      *
      *         RCNONE; stops if there is a MQI completion code      *
      *         of CCFAIL                                            *
      *                                                              *
      *    Program logic:                                            *
      *         MQCONN to the target queue manager                   *
      *         MQOPEN target queue for OUTPUT                       *
      *         for each line in the input array,                    *
      *         .  MQPUT datagram message with text line as data     *
      *         MQCLOSE target queue                                 *
      *         MQDISC from the queue manager                        *
      *                                                              *
      ****************************************************************
      *                                                              *
      *                                                              *
      *                                                              *
      *   Exceptions signaled:  none                                 *
      *   Exceptions monitored: none                                 *
      *                                                              *
      *   AMQ3PUT4 has 2 parameters - (1) name of the target queue   *
      *                               (2) name of the queue manager  *
      *                                                              *
      ****************************************************************
     FQSYSPRT   O    F  132        PRINTER
      **  Test data used as input
     D DATA            S             60    DIM(3) CTDATA PERRCD(1)
      **  message buffer
     D BUFFER          S             60A
      * Handle connection
     D HCONN           S             10I 0
      * Options
     D OPTS            S             10I 0
      * Object handle
     D HOBJ            S             10I 0
      * Completion codes
     D OCODE           S             10I 0
     D CCODE           S             10I 0
      * Reason
     D REASON          S             10I 0
      * Buffer length
     D BUFLEN          S             10I 0
      * Buffer pointer
     D BUFPTR          S               *   INZ (%ADDR(BUFFER))
      *
      **  Declare MQI structures needed
      * MQI named constants
     D/COPY CMQG
      * Object Descriptor
     D MQOD            DS
     D/COPY CMQODG
      * Message Descriptor
     D MQMD            DS
     D/COPY CMQMDG
      * Put message options
     D MQPMO           DS
     I/COPY CMQPMOG
      ** note, sample uses defaults where it can
      *
      * program parameters are: 48-character target queue name
      *                         48-character queue manager name
     C     *ENTRY        PLIST
     C                   PARM                    QNAME            48
     C                   PARM                    QMNAME           48
      ** indicate that sample program has started
     C                   MOVEL     'start'       STATUS            5
     C                   EXCEPT    SAMPLE
      *
      ****************************************************************
      *                                                              *
      *    use parameter as the name of the target queue             *
      *                                                              *
      ****************************************************************
     C                   MOVEL     QNAME         ODON             48
      *
      ** say "target queue is ----"
     C                   EXCEPT    TARGET
      ****************************************************************
      *                                                              *
      *   Connect to the queue manager                               *
      *                                                              *
      ****************************************************************
     C                   CALLP     MQCONN(QMNAME : HCONN : OCODE : REASON)
      *
      * report reason and stop if it failed
     C     OCODE         IFEQ      CCFAIL
      **  "MQCONN ended with reason code ...."
     C                   MOVEL     'MQCONN'      CNAME             6
     C                   MOVE      REASON        RCODE            10
     C                   EXCEPT    MQCALL
      **  "unable to connect to MQM"
     C                   MOVE      OCODE         CCODE
     C                   EXCEPT    MESSC
     C                   SETON                                        LR
     C                   RETURN
     C                   ENDIF
      ****************************************************************
      *                                                              *
      *   Open the target message queue for output (and fail if      *
      *   MQM is quiescing)                                          *
      *                                                              *
      *   Resulting queue handle is HOBJ                             *
      *                                                              *
      ****************************************************************
      * options are Output and Fail-if-quiescing
     C     OOOUT         ADD       OOFIQ         OPTS
      * call ...
     C                   CALLP     MQOPEN(HCONN : MQOD : OPTS : HOBJ :
     C                              OCODE : REASON)
      *
      * report reason, if any; stop if failed
     C     REASON        IFNE      RCNONE
      **  "MQOPEN ended with reason code ...."
     C                   MOVEL     'MQOPEN'      CNAME             6
     C                   MOVE      REASON        RCODE            10
     C                   EXCEPT    MQCALL
     C                   ENDIF
      *
     C     OCODE         IFEQ      CCFAIL
      **  "unable to open queue for output"
     C                   EXCEPT    MESS
     C                   ENDIF
      *
      **  initial loop condition is based on result of MQOPEN
      **  set initial index to data
     C                   Z-ADD     1             I                 5 0
      *   length of each message buffer
     C                   Z-ADD     60            BUFLEN
      *
      *   Start loop to put messages . . .
     C     CCODE         DOWNE     CCFAIL
      * read next line (from test data)
     C     I             IFLT      4
     C                   MOVEL     DATA(I)       BUFFER
     C                   ADD       1             I
      *
     C** . . . put each buffer to message queue
     C                   MOVEL     FMSTR         MDFMT
     C                   CALLP     MQPUT(HCONN : HOBJ : MQMD : MQPMO :
     C                             BUFLEN : BUFPTR : CCODE : REASON)
      *
      ** report reason, if any; stop if failed
     C     REASON        IFNE      RCNONE
      **  "MQPUT ended with reason code ...."
     C                   MOVEL     'MQPUT '      CNAME
     C                   MOVE      REASON        RCODE
     C                   EXCEPT    MQCALL
     C                   ENDIF
      *
      *
      ** satisfy loop end condition after last input line
     C                   ELSE
     C                   Z-ADD     CCFAIL        CCODE
      *  end if (I < 4)
     C                   ENDIF
      **  end DO-while loop; failure causes loop to end
     C                   ENDDO
      *
      ****************************************************************
      *                                                              *
      *   Close the target queue (if it was opened)                  *
      *                                                              *
      ****************************************************************
      * if (OCODE not CCFAIL) ...
     C     OCODE         IFNE      CCFAIL
      *  ... close the queue (no options)
     C                   Z-ADD     CONONE        OPTS
     C                   CALLP     MQCLOSE(HCONN : HOBJ : OPTS :
     C                              CCODE : REASON)
      *
      * report reason, if any
     C     REASON        IFNE      RCNONE
      **  "MQCLOS ended with reason code ...."
     C                   MOVEL     'MQCLOS'      CNAME
     C                   MOVE      REASON        RCODE
     C                   EXCEPT    MQCALL
     C                   ENDIF
      *
      * end if (OCODE not CCFAIL)
     C                   ENDIF
      ****************************************************************
      *                                                              *
      *   Disconnect from the queue manager                          *
      *                                                              *
      ****************************************************************
     C                   CALLP     MQDISC(HCONN : OCODE : REASON)
      *
      * report reason and stop if it failed
     C     OCODE         IFEQ      CCFAIL
      **  "MQDISC ended with reason code ...."
     C                   MOVEL     'MQDISC'      CNAME             6
     C                   MOVE      REASON        RCODE            10
     C                   EXCEPT    MQCALL
     C                   ENDIF
      *
      ** "Sample AMQ1PUT4 end"
     C                   MOVEL     'end  '       STATUS            5
     C                   EXCEPT    SAMPLE
     C                   SETON                                        LR
      ****************************************************************
     OQSYSPRT   E            SAMPLE         1
     O                                           20 'Sample AMQ3PUT4 '
     O                       STATUS              25
     O          E            TARGET         1
     O                                           20 'Target queue is '
     O                       QNAME
     O          E            TARGET         1
     O                                           28 'Target queue manager is '
     O                       QMNAME
     O          E            MQCALL         1
     O                       CNAME               10
     O                                              ' ended with reason code'
     O                       RCODE               45
     O          E            MESSC          1
     O                                           25 'Unable to connect to'
     O                                              ' queue manager'
     O          E            MESS           1
     O                                           25 'Unable to open queue'
     O                                              ' for output'
      ****************************************************************
      *                                                              *
      * END OF AMQ3PUT4                                              *
      *                                                              *
      ****************************************************************
      ****
      *  Sample input follows
      ****
**
This is the first message added to the queue.
This is the second message.
This is the final message.

论坛徽章:
0
7 [报告]
发表于 2004-05-27 12:35 |只看该作者

问高手,谁知道as400上的mq的例子程序

程序定义了两个参数, 分别接受队列名和队列管理器名。 问题在参数上, 你用CL编写一个调用程序, 将队列名和队列管理器名赋值给两个48位长的字符变量,然后再用变量作参数去调用测试程序。

还一个简单办法, 在命令行调用时将两个参数后面加上足够多的空格。例如
‘REQ1                                                                         ’。

祝你好运。  你在那个城市?

论坛徽章:
0
8 [报告]
发表于 2004-05-28 11:01 |只看该作者

问高手,谁知道as400上的mq的例子程序

你的意思是说两个参数在输入后有被覆盖的部分,比如队列名被覆盖了?
我在北京,做一些与400相关的维护工作。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP