× 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.


  • Subject: RE: QMHRDQM API - Retrieve Data Queue Message
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Wed, 20 Dec 2000 11:28:20 -0600 (CST)



On Wed, 20 Dec 2000, Mark Drazic wrote:

>       * Call API to Retrieve Data Queue Entries
>      C                   Call  (E) 'QMHRDQM'
>      C                   Parm                    @dQEntListPtr
> Receiver Variable
>      C                   Parm                    @lenOfDQEntLst
> Length of Receiver Variable
>      C                   Parm                    @dQELFName
> Format name
>      C                   Parm                    @qualDQName
> Qualified Data Queue Name
>      C                   Parm                    DQSelInf01DS
> Message Selection Information
>      C                   Parm                    @lenOfMSelInf
> Length of Message Selection Information
>      C                   Parm                    @mSelInfFName
> Message Selection Information Format Name
>      C                   Parm                    APIErrorDS
> Error Data Structure
> 
> 
> As stated, the pointer as a Receiver Variable is always returned *Null.
> But, if the pointer is changed to a field name, the API immediately starts
> to work and returns information.  
> 


This is because QMHRDQM is expecting to receive a character variable here,
not a pointer!   You can't just arbitrarily change what data type your
passing to it, and expect it to work! :)

Since data is passed by reference (i.e. by pointer) anyway, you could
easily work around this... you could make it point to a user space or
an ALLOC'ed area of memory or whatever you need.

This code should be more or less what you need to do (untested, tho):


      ******************************************************************
      * API Error Code Structure
      ******************************************************************
     D dsEC            DS
     D  dsECBytesP             1      4B 0 INZ(256)
     D  dsECBytesA             5      8B 0 INZ(0)
     D  dsECMsgID              9     15
     D  dsECReserv            16     16
     D  dsECMsgDta            17    256

      * Retrieve Data Queue Message API
      *
     D RtvDQM          PR                  ExtPgm('QMHRDQM')
     D   RcvVar                   32766A   OPTIONS(*VARSIZE)
     D   RcvVarLen                   10I 0 const
     D   Format                       8A   const
     D   QualDQ                      20A   const
     D   MsgSelInfo               32766A   OPTIONS(*VARSIZE)
     D   MsgSelLen                   10I 0 const
     D   MsgSelFmt                    8A   const
     D   ErrorCode                32766A   OPTIONS(*VARSIZE)

      ******************************************************************
      * Local variables:
      ******************************************************************
     D p_RcvVar        S               *
     D SomeVar         S              1A   based(p_RcvVar)
     D Msg             S             50A


      *** Grab a big area of memory
     C                   alloc     65536         p_RcvVar

      *** Dump Data queue entries
     C                   callp     RtvDQM(SomeVar: 65536: 'RDQM0100':
     C                                    'DATAQ     LIB': SelInfoDS:
     c                                    %size(SelInfoDS): 'RDQS0100':
     c                                    dsEC)

     c                   if        dsECBytesA > 0
     C* deal with error calling QMHRDQM
     c                   endif


Since "SomeVar" is at the beginning of the area of memory that you
allocated, and the length that you're telling the API to use is 65536,
it should go into the memory you ALLOC'ed.

You couldn't just pass "p_RcvVar" directly, because the API is expecting
a character field.

HTH


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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-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.