John,

The message key is a binary value that takes up 4 bytes. It will look
like gibberish to the naked eye. If you are using RPG message key can
be defined as an int.

Prompt the rcvmsg command, press F1 on a field, then F2 and go to the
bottom of the help text. There you will find the messages you can
monitor for.

As Chuck pointed out there is CPF2410 to look for. There are also
others you may want to monitor for - CPF2415, CPF247A, CPF2479 and
CPF2551 to mention a few.

Again as Chuck pointed out you can try PGMQ(*SAME (*)) rather than
PGMQ(*EXT).


Gary

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Rusling, John
Sent: Wednesday, April 27, 2011 10:22 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: If MSGTYPE has *NEXT or *PRV specified, MSGKEY is required.

Thanks for the replies :-)

I put in what Gary suggested.

2 things -
In debug, after the first rcvmsg call, the value of the keyvar looks
like gibberish,
(reverse img chars etc) Shouldn't this be clear, legible text?

2nd thing, it now crashes, right away, on the second rcvmsg call
(the one with msgkey), as per message below.

Message . . . . : Application error. CPF2410 unmonitored by GARMON at
statement 0000000204, instruction X'0000'.

Any ideas?

Gonna do some trial and error and reading-up,
(not necessarily in that order)

John B



/*-------------------------------------------------------------------*/
/* Program...: GARMON */
/* Trap and extract the data message for CPF1002 */
/* */
/*-------------------------------------------------------------------*/
pgm
dcl var(&keyvar) type(*char) len( 4)
dcl var(&msgkey) type(*char) len( 4)
dcl var(&msg) type(*char) len(512)
dcl var(&msgdta) type(*char) len(100)
dcl var(&msgdtalen) type(*dec) len(5 0)
dcl var(&msgid) type(*char) len( 7)
dcl var(&severity) type(*dec) len(2 0)
dcl var(&msgfile) type(*char) len( 10)
dcl var(&msgflib) type(*char) len( 10)


/*
*/
/* allocate object
*/
/*
*/
alcobj OBJ((qiws/qcustcdt *FILE *EXCL))

monmsg msgid(CPF1002) exec(goto trapit)
/*monmsg msgid(CPF4128) exec(goto trapit)*/

/*
*/
/* de-allocate object
*/
/*
*/
dlcobj OBJ((qiws/qcustcdt *FILE *EXCL))

goto end

trapit:
/* receive the last message */
rcvmsg pgmq(*EXT) +
msgtype(*LAST) +
rmv(*NO) +
msg(&msg) +
msgdta(&msgdta) +
msgdtalen(&msgdtalen) +
msgid(&msgid) +
sev(&severity) +
msgf(&msgfile) +
msgflib(&msgflib) +
keyvar(&keyvar)

next:
/* receive the previous message */
chgvar var(&msgkey) value(&keyvar) /* Set message key */
rcvmsg pgmq(*EXT) +
msgtype(*PRV) +
rmv(*NO) +
msgkey(&msgkey) +
msg(&msg) +
msgdta(&msgdta) +
msgdtalen(&msgdtalen) +
msgid(&msgid) +
sev(&severity) +
msgf(&msgfile) +
msgflib(&msgflib) +
keyvar(&keyvar)

if (&msgid *NE 'CPF1002') then(do)
goto next
enddo

if (&msgid *EQ 'CPF1002') then(do)
/* Retrieve the cpf1002 msg w/ it's substitution values */
/* Call program, pass msg to it */
enddo


end:
endpgm



IMPORTANT NOTICE: This message is intended only for the addressee and
may contain confidential, privileged information.
If you are not the intended recipient, you may not use, copy or disclose
any information contained in the message.
If you have received this message in error, please notify the sender by
reply e-mail and delete the message.


This thread ...

Replies:

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

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