|
Robert,
Once a call stack has ended (as is the case with 'ProgD' in your
example) you can no longer refer to messages in it's message queue by
the call stack level or program name.
However, you can still work with the message by message key.
You appear to be saving the key to &W@MSGNO, so you could potentially
pass that back up the call stack.
If you don't have the message key for the message, then there are two
ways to get it. (1) You can call the QMHLJOBL API which lists the whole
job log (including message keys for all messages) to a user space. (2)
or, you can rely on the fact that message keys are really a 4-byte
integer value, the OS keeps adding to it for every new message. So you
could loop through a range of numbers and look for your message.
(Usually you do this by putting a "marker" mesage in the jog before
calling ProgB, and then another "marker" message after ProgB ends...
that gives you from/to keys that you can loop between.)
Hope that helps.
On 4/20/2010 9:57 AM, Robert Rogerson wrote:
I'm having trouble receiving a message which I can see in the job log.Here
is the scenario...')
ProgA calls ProgB
ProgB calls ProgC
An error occurs in ProgC
ProgC calls ProgD to send the message
ProgD sends the message (SNDPGMMSG MSGID(WDC0145) MSGF(TFMMSG) MSGDTA('
TOPGMQ(*SAMEerrors
('WIM331')) KEYVAR(&W@MSGNO)
ProgD ends
ProgC ends
ProgB ends returning an error
If an error occurred
// Receive program message
QMHRCVPM( msgBack
: %Size(msgBack)
: 'RCVM0100'
: '*'
: 0
: '*PRV'
: Pm_MKey
: 0
: '*SAME'
: Qusec )
I want to receive the message issued by ProgD (this may be different
depending on the error generated in ProgC) so I may display it in ProgAto
give a better indication of what error occurred.
One condition I should add is that ProgC and ProgD are vendor supplied
programs I am trying to avoid changing.
Can anyone shed some light on what I am doing wrong?
Thanks,
Rob
--
This is the RPG programming on the IBM i / System i (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 mailing list archive is Copyright 1997-2025 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.