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



Sorry. It seems my example overlooked a point. You are not using the
msgkey() parameter on your second rcvmsg. meyvar() returns a message
key. msgkey() provides a message key.

Declare separate variables for keyvar() and msgkey().

Leave msgkey() off your first rcvmsg. After your first rcvmsg set your
msgkey() variable to the keyvar() value.

If you loop through the second rcvmsg you do the same.

dcl var(&msgkey) type(*char) len( 4)
dcl var(&keyvar) type(*char) len( 4)

/* 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:

chgvar var(&msgkey) value(&keyvar) /* Set message key */

/* receive the previous message */
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
Gary

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

I'm trying to compile a clle program and keep getting:
"CPD2436 30 If MSGTYPE has *NEXT or *PRV specified, MSGKEY is
required."

It happens on the 2nd invocation of the rcvmsg command. (pgm below)

The recovery doesn't tell me anything either -
"Either add a MSGKEY parameter, or change the value specified for
MSGTYPE."

I have the msgkey variable defined and in the call??

Any help is appreciated, thanks,

John B



pgm

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((EBIIN *FILE *EXCL))

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

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

goto end


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

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

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.


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.