RPG Program in MSGW status blocks Java Application

2790 pts.
Hello. I'm looking for the best way to identifying when a RPG program called from java is waiting for a message response (MSGW status). When this situation ocurrs, my java application waits for the RPG execution returns, indefinitely.

Software/Hardware used:
Java 1.6, Tomcat, RPG programs.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Discuss This Question: 2  Replies

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.
  • TomLiotta
    That's a tricky problem for a couple reasons. First, AFAIK, RPG programs usually don't go into MSGW status. Let me explain my reasoning... MSGW usually comes from one of three sources as far as RPG is concerned. RPG can call the Receive Nonprogram Message (QMHRCVM) or Receive Program Message (QMHRCVPM) APIs with wait times, and those APIs can then go into a message wait state while the RPG is in a kind of wait for the API to return. Now, I'm pretty sure that's not the kind of MSGW you're interested in. Or some function such as output to a printerfile can hit some system limit such as maximum spooled records, and that function can wait on an operator response for guidance on how to proceed. (The operator might be the requester.) Finally, an actual error in coding might trigger an exception that isn't handled by a condition handler, e.g., divide by zero. An inquiry message asking what option to take (e.g., 'C', 'R' or 'D') can be sent to an operator. One of those last two would be likely for you because you likely know if the RPG is trying to process a program or non-program message queue or not. That is, you should know if message queue monitoring is part of the normal program function or not. If you don't know, then it can get complicated because you have to retrieve enough job info to determine what kind of MSGW is going on. In all three cases (AFAIK), the MSGW status is attached to the job rather than the program itself. So, you need to know first what job the RPG is running in. Then you need some secondary process (some secondary thread?) that can run while the RPG job is concurrently running. That thread can't be blocked while the RPG job is running. It would periodically retrieve the job status and make decisions when MSGW showed up. As for what it would do when MSGW was seen...? Am I making any sense in this? Tom
    125,585 pointsBadges:
  • Vatchy
    There are several different solutions to this problem. First, identify the problem that the RPG program is experiencing and fix it. Second, monitor the message queue and answer the message quickly. Third, add a reply to the system reply list in order to answer the message automatically. Fourth, buy software like Robot to monitor the messages for you. Hope this helps.
    1,415 pointsBadges:

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.

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


Share this item with your network: