ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Program to push in MSGW

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Program to push in MSGW

    Hi All,

    I have to use SNDPGMMSG in my RPGLE program. I would like to know how we can use this in an RPGLE.
    Also will it get any reply like we get on default message handler (C, I, D, R) using SNDPGMMSG.

    On my submitted job when there is record lock I need to send message and get reply but due to Monitor and ENDMON in my RPGLE program it is not going in MSGW status because On-Error nothing is doing thus I will add %Status = 01218 and then use SNDPGMMSG to send message and get reply like default message handler.

    Please let me know if any other way is available to achieve this.

    Thanks,
    NIL
    Cheers...
    Nil

  • #2
    I've never done what you're trying to do, Nil, but I can tell you that an RPG program can call the QMHSNDPM API to do what the SNDPGMMSG commands does in CL.

    Comment


    • #3
      I'm sure it's possible and some clever people here could probably whip something up. I did try something like this ages ago but had loads of difficulties doing it using the APIs - sending to QSYSOPR MSGQ was problematic along with getting replies from memory. In the end I thought, well, this is an ILE program so why not put the code in a simple CL module. It was much easier and you may find that an easier alternative.

      Comment


      • #4
        Using a CL module might be the easiest way, as John suggests.

        If you do want to do it in RPG, you'd need to use the QMHSNDPM API to send the message, and then QMHRCVPM to wait for the response. (Unless it's an exception message, of course...)

        It is very strange to want to require the user to answer a message, however. For most programmers, one of the main goals is to try to avoid users having to deal with errors.

        Comment

        Working...
        X