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




On 21/02/2007, at 9:16 AM, Jim Wiant wrote:

Am I missing something obvious? Any Ideas?

Does it always fail on *INQ messages?

Your description seems fine. I've used both the QMHRCVM API and the RCVMSG command to process messages from message queues for years and they've both worked reliably and as expected (unless my code was at fault--rare occurrence I admit but has been known).

Here is a quick example in CL. Test it by starting it in one job and then send messages to QSYSOPR from another job. The text of each message should appear on the message line of the first job:

pgm

dcl &rcvVar *char 4096
dcl &rcvVarLen *char 4
dcl &msgKey *char 4
dcl &wait *char 4  value(X'00000000')
dcl &errcode *char 8 value(X'0000000000000000')

dcl &keyvar *char 4
dcl &msgid *char 7
dcl &msgtxt *char 50
dcl &msgdtalen *dec (10 0)
dcl &msglen *dec (10 0)
dcl &msgpos *dec (10 0)

chgvar %bin(&rcvVarLen) 4096
             CALL       PGM(QMHRCVM) PARM(&RCVVAR &RCVVARLEN +
                          'RCVM0200' 'QSYSOPR   *LIBL     ' +
                          '*LAST     ' &MSGKEY &WAIT '*SAME     ' +
                          &ERRCODE)
chgvar &keyvar %sst(&rcvvar 22 4)
if (&keyvar *eq '    ') do
  chgvar &keyvar '*TOP'
enddo

chgvar %bin(&wait) -1

loop: chgvar &msgkey &keyvar
             CALL       PGM(QMHRCVM) PARM(&RCVVAR &RCVVARLEN +
                          'RCVM0200' 'QSYSOPR   *LIBL     ' +
                          '*NEXT     ' &MSGKEY &WAIT '*SAME     ' +
                          &ERRCODE)

chgvar &msgid %sst(&rcvvar 13 7)
chgvar &keyvar %sst(&rcvvar 22 4)
chgvar &msgdtalen %bin(&rcvvar 153 4)
chgvar &msglen    %bin(&rcvvar 161 4)
if (&msgid *eq '       ') do /* Impromptu message */
  chgvar &msgpos 177
  chgvar &msgtxt %sst(&rcvvar &msgpos &msgdtalen)
enddo
else do
  chgvar &msgpos (177 + &msgdtalen)
  chgvar &msgtxt %sst(&rcvvar &msgpos &msglen)
enddo

sndpgmmsg  msgid(cpf9898) msgf(qcpfmsg) msgdta(&msgtxt) +
             topgmq(*ext) msgtype(*status)

goto loop

endpgm

Use SysReq 2 to end it. Fairly simple code but it may help to highlight differences in your code. If you still can't work it out post a cut-down version of your source (just the API calls and the loop).

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         OS/400, i5/OS Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



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.