× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Marilyn,

Thinking this through as I type......

Have you considered "parsing" the MQ Message before placing it
in the array?  In other words, MQSeries is passing your program
a message/string, not an array.  Mapping output of your MQGET
instruction to the array or Data structure will be problematic
as you can't guarantee your XML "fragments" won't span multiple
elements.  This would work if you were using fixed format, but
then why us XML.  

Have you considered using allocated storage to receive the output
from MQGET (verses an array or DS)?  From there you can use a variety
of methods (including XML parser) to extract your data.

Following is an example that "gets" message in browse mode, returning
them into a 10,000 byte allocated storage space.  The program then
displays the returned string on STDOUT.

Hope this helps.

Michael Rooney
Citigroup International


     H
      *********************************************************************
      * Bind with service program LIBMQM in library QMQM and
      * service program QC2IO in QSYS library.
      *********************************************************************
     DMQSample         PR
      *
     DMQGMO            DS
     D/COPY QMQM/QRPGLESRC,CMQGMOG
     DMQMD             DS
     D/COPY QMQM/QRPGLESRC,CMQMDG
     DMQOD             DS
     D/COPY QMQM/QRPGLESRC,CMQODG
      *
     DMQSample         PI
      *
     /*********************************************************************/
     /*
     /* Compile using:
     /*
     /* CRTRPGMOD MODULE(MQSample)
     /* CRTPGM PGM(MQSample) BNDSRVPGM(QMQM/LIBMQM QSYS/QC2IO)
     /*
     /*********************************************************************
      *
     Dprintf           PR                  EXTPROC('printf')
     D                                 *   value options(*string)
      * Queue Manager Name
     DQMgrName         S             48A   inz(*blank)
      * Connection handle
     DHconn            S             10I 0
      * Completion code
     DCompCode         S             10I 0
      * Reason code qualifying CompCode
     DReason           S             10I 0
      * Options that control the action of MQOPEN
     DOptions          S             10I 0
      * Object handle for inquirying MQ Manager
     DHobj             S             10I 0
      * Length of the message
     DBufferLength     S             10I 0
      * Length of the message
     DDataLength       S             10I 0
      * Selector Count for MQINQ
     DReplyptr         S               *
      *
     C                   EVAL      QMgrName = ' '
      *
     C                   MONITOR
      *
     C                   CALLP     MQCONN(QMgrName:Hconn:CompCode:Reason)
      *
     C                   ON-ERROR
     C                   callp     printf('Error loading MQSeries Prod'+
     C                             'uct.....program terminating.' +
     C                             x'15')
     C                   move      *on           *inlr
     C                   return
     C                   ENDMON
      *
     C                   if        CompCode = MQCC_FAILED
      *
     C                   callp     printf('Program failed to connect to'+
     C                             ' Queue Manager('+%trimr(QMgrName)+').' +
     C                             ' Reason Code is '+%char(Reason)+'.'+
     C                             x'15')
      *
     C                   callp     printf('Program is terminating.' +
     C                             x'15')
      *
     C                   move      *on           *inlr
     C                   return
     C                   endif
      *
      * Set Open Options to Input & Browse
      *
     C                   EVAL      Options = (MQOO_BROWSE + MQOO_INPUT_AS_Q_DEF)
     /* Get the queue name */
     C                   EVAL      ODON = 'SYSTEM.DEFAULT.LOCAL.QUEUE'
      *
     C                   EVAL      ODOT = MQOT_Q
      *
     C                   CALLP     MQOPEN(Hconn:MQOD:Options:Hobj:CompCode:
     C                             Reason)
     C     CompCode      IFEQ      MQCC_FAILED
     C                   callp     printf('Program failed to open queue '+
     C                             %trimr(ODON) +'.' + ' Reason Code is '+
     C                             %char(Reason)+'.'+
     C                             'Program is terminating.' +
     C                             x'15')
      *
     C                   move      *on           *inlr
     C                   return
     C                   endif
      ********************************************************************
      * Prepare to Get Messages from Queue                               *
      ********************************************************************
      *
      * Define Message Buffer Length
      *
     C                   EVAL      BufferLength = 10000
     C                   eval      Replyptr = %alloc(BufferLength)
      *
     C     GetNxtMsg     tag
      *
      * (re)Set Get Message Options to Accept Truncated Message, Fail if 
Quiescing & Browse
      *
     C                   EVAL      GMOPT = (64 + 8192 + 32)
      *
      * Initialize Message and Correlation Id (may have been modified by MQPUT).
      *
     C                   EVAL      MDMID = MQMI_NONE
     C                   EVAL      MDCID = MQCI_NONE
      *
      * Execute MQGET in Browse Mode
      *
     C                   CALLP     MQGET(Hconn:Hobj:MQMD:MQGMO:
     C                             BufferLength:Replyptr:
     C                             DataLength:CompCode:
     C                             REASON)
      *
     C     CompCode      IFEQ      MQCC_FAILED
     C                   if        REASON = MQRC_NO_MSG_AVAILABLE
     C                   callp     printf('Program completed!' +
     C                             x'15')
      *
     C                   else
     C                   callp     printf('MQGET failed! '+
     C                             'Reason Code is '+
     C
     C                             %char(Reason)+'.'+
     C                             'Program is terminating.' +
     C                             x'15')
      *
     C                   endif
      *
     C                   dealloc                 Replyptr
     C                   move      *on           *inlr
     C                   return
      *
     C                   endif
      *
     C                   callp     printf('        ' +
     C                             %str(Replyptr) +
     C                             x'15')
      *
     C                   goto      GetNxtMsg




As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.