× 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: RCVMSG question/problem.
  • From: "Simon COulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Sun, 12 Nov 00 11:30:49 +1100


Hello Larry,

You wrote:
>I'm trying to use RCVMSG after making changes with WRKUSRPRF to catch
>the CPC2204 and CPC2205 completion messages. No matter what I do the
>RCVMSG returns a blank message number (which means no message recieved).
>This fails if I use *ANY or *COMP for the message type to be recieved. 
>If I artificially send those messages (with SNDPGMMSG) earlier I can
>retrieve these with no problem. If I use DSPJOBLOG I see the CPC2204/5
>messages in the joblog but they never get recieved. Here is the snippet
>of code that is failing to retrieve any messages whatever.

> MSGLOOP:    RCVMSG     MSGTYPE(*ANY) MSGDTA(&MSGDTA) MSGID(&MSGID)  
>             IF         COND(&MSGID *EQ '       ') THEN(GOTO DAEND)   
>                  < do stuff >
>             GOTO MSGLOOP

Firstly, the default behaviour of RCVMSG is to receive message from PGMQ(*SAME) 
meaning 
the program in which the command is run.  The other choices are PGMQ(*PREV) 
which means 
your caller, and a named program queue which must be active and in the stack 
above your 
program.  Since the messages are not sent to your program queue the form of 
RCVMSG you 
use will never work.

Secondly, I don't think you can do what you want with your current approach.  
It is 
impossible to retrieve messages from a program queue that is no longer active 
unless you 
know the message key.  You can only get the message key by receiving the 
message 
(Catch-22) or when you send the message.

Your program structure seems to be as follows:

        YOUR_PGM
                WRKUSRPRF
                        QMNWRKXX
                                QSYUP
                RCVMSG

QMNWRKXX is the CPP for most of the various WRKxxxxx commands.  It calls QSYUP 
to create 
or change a user profile.  QSYUP sends the CPC2204 and CPC2205 messages back to 
the 
QMNWRKXX program queue where they stay.  Your code then invokes RCVMSG but the 
QMNWRKXX 
is no longer an active call stack entry and you cannot address the program 
queue of an 
inactive program.  Even the QMHRCVPM API will not help.

Ed's suggestion of PGMQ(*PREV) won't work because the program queue containing 
the 
messages is not previous to your program but after your program.

One possible approach is to use the QMHLJOBL (List Joblog) API and build the 
list from 
the bottom (List direction *PREV, message key X'FFFFFFFF').  Process the list 
looking for 
your completion messages.  When you reach a request message containing 
WRKUSRPRF you know 
you're done.

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           «»
«» Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      «»
«»                                                                «»
«» Windoze should not be open at Warp speed.                      «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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 ...


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.