AS/400 message queue

70 pts.
Tags:
AS/400
AS/400 message queues
AS/400 Primary Language CL RPG
Hi dear All,

I'm stuck up.. in my first message queue program.

I read message on the *msgq (using RCVMSG) and write it in a PF.

I've 2 (dumb) Questions.

1. I provide 'message queue' as a parameter to RCVMSG command. when the command is executed, it reads only one row at a time. so If I've 15 rows of messages on a queue, I execute RCVMSG in a loop and save messages one by one. Is this the correct approach?

2. Once I'm done executing this program, IF I again call the same program RCVMSG doesnt read anything from the message Q (I dont remove messages in RCVMSG). this directs me to the thought that, any message queue can be read only once even if I dont remove any message from the Q. Is this true? if yes then what if I need to execute this program more than once due to some failures/exceptions

Command I use

RCVMSG     MSGQ(&EMSGQ) RMV(*NO) MSG(&FSTLVL) +                   SECLVL(&SNDLVL)     

 

This is what the message queue contains -

Company Code Required                                                 Enter Account Code                                                    Product Deduction Group 001 has been copied to Deduction Group 001.   Product Coverage not found.                                           Errors occurred while processing GGI Component 75016 19.              Errors occurred while processing Transaction Component '75016' '19'.  Errors occurred while processing GGI Transaction 75016.              



Software/Hardware used:
AS400/ RPG/CL
ASKED: June 17, 2010  1:29 PM
UPDATED: June 17, 2010  6:08 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    First, unless you maintain strict control over what messages may be sent to your message queue, it doesn't make much sense to "write it in a PF". A PF isn't very well suited for many messages. Second, yes, RCVMSG will return one message at a time. If you need to collect sets of messages, use the List Nonprogram Messages (QMHLSTM) API and process each set before requesting the next. Third, to handle old messages with RCVMSG, review the PGM() and RESET() parameters of the CHGMSGQ command. In particular, note the {help} text reference to message keys. You can receive any message if you know its message key. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following