×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Currently we succesfully parse MQ messages with IBM XMLPR500 in this way.

first we get the lengh of the message:

MQGMO.GMOPT  = GMWT;   // MQGMO_WAIT
MQGMO.GMOPT += GMLK;   // MQGMO_LOCK
MQGMO.GMOPT += GMATM;  // MQGMO_ACCEPT_TRUNCATED_MSG
MQGMO.GMOPT += GMCONV; // MQGMO_CONVERT
MQGMO.GMOPT += GMBRWF; // MQGMO_BROWSE_FIRST
MQMD.MDMID   = MINONE; // MQMI_NONE
MQMD.MDCID   = CINONE; // MQCI_NONE
BUFLEN = 0;
BUFPTR = %alloc(1);
MQGET(HCONN: HQGET: MQMD: MQGMO: BUFLEN: BUFPTR:
      MSGLEN: CMPCOD: REASON);

then we get the message

BUFLEN = MSGLEN;
BUFPTR = %realloc(BUFPTR:BUFLEN);
MQGMO.GMOPT  = GMNWT;  // MQGMO_NO_WAIT
MQGMO.GMOPT += GMMUC;  // MQGMO_MSG_UNDER_CURSOR
MQGMO.GMOPT += GMCONV; // MQGMO_CONVERT
MQMD.MDMID   = MINONE; // MsgId selector
MQMD.MDCID   = CINONE; // CorrelId selector
MQMD.MDCSI   = 280;    // CCSID locale
MQGET(HCONN: HQGET: MQMD: MQGMO: BUFLEN: BUFPTR:
      MSGLEN: CMPCOD: REASON);

then we call a program that parses the message only to get the method

MQ_PARSE (BUFPTR:MSGLEN);

This program parses the document and finds the method to call (here we have
something like
<Process>XYZ</Process>  where XYZ is the program that actually parses the
specific message:

QxmlInit(envData);
DomParse =QxmlXercesDOMParser_new(PenvData);
MemBufInputSource = QxmlMemBufInputSource_new(
                    MSGPTR:MSGLEN:buf:280:0:0);
QxmlXercesDOMParser_parse_InputSource(DomParse:MemBufInputSource);
DomDoc = QxmlXercesDOMParser_getDocument(DomParse);
GetTagOpt = %alloc(256);
%str(GetTagOpt:256) = 'Process';
NodeList = QxmlDOMDocument_getElementsByTagName
              (DomDoc:GetTagOpt:Qxml_CHARSTR:0);
Node = QxmlDOMNodeList_item(NodeList:0);
if QxmlDOMNode_isNull(Node) = Qxml_NODNOTNUL;
  if QxmlDOMNode_getNodeType(Node) = Qxml_ELMNT_NOD;
    Child = QxmlDOMNode_getFirstChild(Node);
    if QxmlDOMNode_getNodeType(Child) = Qxml_TEXT_NOD;
      NodeValue =QxmlDOMNODE_getNodeValue(Child);
      QxmlTranscode(NodeValue:Qxml_UNICODE:oStgP:BpP:Bap:280);
      Method = %str(oStgP);
    endif;
  endif;
endif;

and then call a program (in this example XYZ) that actually retrieves the
elements from the parsed document:

call(e)   Method
parm                    DomDoc
parm                    MSGPTR
parm                    MSGLEN

------------
Beppe.

----- Original Message ----- 
From: "Rooney, Michael P" <michael.p.rooney@xxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Monday, May 03, 2004 5:02 PM
Subject: RE: How to scan an entire array all at once (Corrected source)


>
> Marilyn,
>
> In cutting & pasting previous post, I inadvertantly omitted some source
> statements.  The following is the corrected source:
>
> Regards,
>
> Michael Rooney
> Citigroup International
>
>
>      H
>
*********************************************************************
>       * Bind with service program LIBMQM in library QMQM and
>       * service program QC2IO in QSYS library.
>       *
>       * Compile using:
>       *
>       * CRTRPGMOD MODULE(MQSample)
>       * CRTPGM PGM(MQSample) BNDSRVPGM(QMQM/LIBMQM QSYS/QC2IO)
>       *
>
*********************************************************************
>      DMQSample         PR
>       *
>      DMQCC_FAILED      C                   CONST(2)
>      D* Message Identifier
>      DMQMI_NONE        C                   CONST(X'00000000000000000000-
>      D                                     0000000000000000000000000000-
>      D                                     ')
>      D*
>      D* Correlation Identifier
>      DMQCI_NONE        C                   CONST(X'00000000000000000000-
>      D                                     0000000000000000000000000000-
>      D                                     ')
>      D* Open Options
>      DMQOO_...
>      DINPUT_AS_Q_DEF   C                   CONST(1)
>      DMQOO_BROWSE      C                   CONST(8)
>      D* Object Types
>      DMQOT_Q           C                   CONST(1)
>      DMQRC_NO_MSG_...
>      DAVAILABLE        C                   CONST(2033)
>       *
>      D/COPY QMQM/QRPGLESRC,CMQG
>      DMQGMO            DS
>      D/COPY QMQM/QRPGLESRC,CMQGMOG
>      DMQMD             DS
>      D/COPY QMQM/QRPGLESRC,CMQMDG
>      DMQOD             DS
>      D/COPY QMQM/QRPGLESRC,CMQODG
>       *
>      DMQSample         PI
>       *
>       *
>      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 = 'EXCELLER.LATAM.LISTEN'
>       *
>      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 + 16384)
>       *
>       * 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(%trimr(%str(Replyptr)) +
>      C                             x'15')
>       *
>      C                   goto      GetNxtMsg
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.