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



Hi Uros,

> Trying to send an inquiry message to QSYSOPR, regardless of its state
> (batch or interactive). I've accomplished this in a CL via the SNDUSRMSG
> command, but having a tough time finding RPG equivalents.

The SNDUSRMSG command is actually a shortcut for calling two CL commands.
The SNDPGMMSG and RCVMSG commands can be used together to achive the
same effect.

When doing the same thing in ILE RPG, you can use teh QMHSNDM and QMHRCVPM
APIs together to achive the same results you get with SNDUSRMSG.

> Played around with QMHSNDM and PM and RCVM and RCVPM, but for some
> reason, I cannot get the program to wait for the message to be answered.
> The message needs to go to QSYSOPR, regardless of state, so *EXT is not
> a valid option for QMHSNDM. Any ideas?

You don't want *EXT... You want to send to *SYSOPR.  Here's a sample
program that should be pretty close to what you want to do...

     D QMHSNDM         PR                  ExtPgm('QMHSNDM')
     D   MsgID                        7A   const
     D   QualMsgF                    20A   const
     D   MsgTxt                   32767A   const options(*varsize)
     D   MsgTxtLen                   10I 0 const
     D   MsgType                     10A   const
     D   MsgQueues                   20A   const dim(50) options(*varsize)
     D   NumQueues                   10I 0 const
     D   RpyQueue                    20A   const
     D   MsgKey                       4A
     D   ErrorCode                 8000A   options(*varsize)
     D   CCSID                       10I 0 const options(*nopass)

     D QMHRCVPM        PR                  ExtPgm('QMHRCVPM')
     D   MsgInfo                  32767A   options(*varsize)
     D   MsgInfoLen                  10I 0 const
     D   Format                       8A   const
     D   StackEntry                  10A   const
     D   StackCount                  10I 0 const
     D   MsgType                     10A   const
     D   MsgKey                       4A   const
     D   WaitTime                    10I 0 const
     D   MsgAction                   10A   const
     D   ErrorCode                 8000A   options(*varsize)

     D RCVM0100        DS                  qualified
     D   BytesRtn                    10I 0
     D   BytesAvail                  10I 0
     D   MsgSev                      10I 0
     D   MsgID                        7A
     D   MsgType                      2A
     D   MsgKey                       4A
     D                                7A
     D   CCSID_status                10I 0
     D   CCSID                       10I 0
     D   MsgDtaLen                   10I 0
     D   MsgDtaAvail                 10I 0
     D   MsgDta                    8000A

     D ErrorCode       ds                  qualified
     D   BytesProv                   10I 0 inz(0)
     D   BytesAvail                  10I 0 inz(0)

     D Message         s            100A   varying
     D MsgKey          s              4A
     D MsgQ            s             20A   dim(1) inz('*SYSOPR')
     D Reply           s            100A

      /free

          // Send an *INQ message to QSYSOPR asking for a reply.
          //
          //  The message will look like the following:
          //
          //   From  . . . :   MYUSERID       07/19/04   14:00:16
          //   Please Reply to this message.
          //     Reply . . :   boing
          //
          //  If you want to remove the "From . . ." line from the
          //  message display, you can do so by specifying a MsgID
          //  and MsgFile as the first two parameters to QMHSNDM API.

            Message = 'Please reply to this message.';

            QMHSNDM( *blanks
                   : *blanks
                   : Message
                   : %len(Message)
                   : '*INQ'
                   : MsgQ
                   : %elem(MsgQ)
                   : '*PGMQ'
                   : MsgKey
                   : ErrorCode );

          // Wait up to 1 hour (3600 seconds) for a reply to the
          // above message. If you change the value of 3600 below to
          // a value of -1, it will wait indefinitely.

            QMHRCVPM( RCVM0100
                    : %size(RCVM0100)
                    : 'RCVM0100'
                    : '*'
                    : 0
                    : '*RPY'
                    : MsgKey
                    : 3600
                    : '*REMOVE'
                    : ErrorCode );

            Reply = %subst(RCVM0100.MsgDta: 1: RCVM0100.MsgDtaLen);

            // The "Reply" Variable should now contain the user's
            // reply.

            *inlr = *on;
      /end-free

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.