ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SNDPGMMSG and RCVMSG

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

  • SNDPGMMSG and RCVMSG

    In my CLLE program, I execute command
    Code:
    SNDPGMMSG  MSGID(XYZ6001) MSGF(XYZMSGF) TOPGMQ(*EXT) + 
                 MSGTYPE(*INQ) KEYVAR(&KEY)
    followed by the following command:
    Code:
    RCVMSG     PGMQ(*EXT) MSGQ(*PGMQ) MSGTYPE(*RPY) + 
                 MSGKEY(&KEY) MSG(&RPY)
    The RCVMSG command causes a Message key not found in message queue &1 error to be issued. Any idea what causes this or how to prevent it. What I am trying to do is have the program issue and inquiry message to the *EXT msg queue and then have the program receive and process the reply. &KEYVAR is defined as *CHAR 4 and &RPY is defined as *CHAR 1. Any suggestions as to how to accomplish this would be appreciated.
    Starts
    April 25, 2018
    Ends
    April 30, 2018

  • #2
    I have a program with similar code, but mine doesn't have PGMQ(*EXT) for the RCVMSG.

    This works:
    Code:
    SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) TOPGMQ(*EXT) +
                 MSGDTA('hello') +
                 MSGTYPE(*INQ) KEYVAR(&KEY)
    RCVMSG     MSGQ(*PGMQ) MSGTYPE(*RPY) +
                 MSGKEY(&KEY) MSG(&RPY)

    Comment


    • #3
      Originally posted by Barbara Morris View Post
      I have a program with similar code, but mine doesn't have PGMQ(*EXT) for the RCVMSG.

      This works:
      Code:
      SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) TOPGMQ(*EXT) +
      MSGDTA('hello') +
      MSGTYPE(*INQ) KEYVAR(&KEY)
      RCVMSG MSGQ(*PGMQ) MSGTYPE(*RPY) +
      MSGKEY(&KEY) MSG(&RPY)
      I removed the PGMQ(*EXT) from my RCVMSG per your example and it works now.........thx

      Comment


      • gregwga50
        gregwga50 commented
        Editing a comment
        One more thing. If possible, I would like to be able to remove the message and the corresponding reply. When I insert
        RMVMSG MSGKEY(&KEY) CLEAR(*BYKEY) after the RCVMSG MSGQ(*PGMQ) MSGTYPE(*RPY) MSGKEY(&KEY) MSG(&RPY) they are not removed. RMVMSG CLEAR(*ALL) removes them but also removes other message on the *EXT queue
    Working...
    X