sending message and variable to message queue using RPGIII

Application development
Is there a way using RPGIII that I can send a message with a variable to a message queue?

Answer Wiki

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

To my knowledge, there’s no RPG op-code that would do what you want.

But it shouldn’t be any problem using QCMDEXC. Or a low-tech solution would be to simply pass the message text in a parameter call to a CL program…and let the CL program send the message.

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.
  • WaltZ400
    Go to the iSeries Information Center on the IBM web site and look at an API program named QMHSNDM. This works similar to the SNDPGMMSG command as it allows you to send a message to a user or other message queue. It will pass a plain text message or a message ID with message data passed to it. This API program can be called from an RPG program.
    655 pointsBadges:
  • JPLamontre
    the code : H 1 Y ?F* KINFDS FIDS ?F* KINFSR *PSSR IFIDS E DSKINFDS IPSDS ESDSKINFSR IFICMAP DS 25 I 1 10 WLIBEN I 11 12 WENV *DATE AMJ7 MAPICS I DS 7 I 1 70DT7A I 1 10DT7ASS I 2 30DT7AAA I 4 50DT7AMM I 6 70DT7AJJ *DATE AAMJ I DS 8 I 1 80DT8A I 1 20DT8ASS I 3 40DT8AAA I 5 60DT8AMM I 7 80DT8AJJ *DATE JMAA I DS 8 I 1 80DT8J I 1 20DT8JJJ I 3 40DT8JMM I 5 60DT8JSS I 7 80DT8JAA ? * Programme driver I DS I 1 4 W0FLSP I 1 2 W1FLSP I 3 4 W2FLSP ? * PARAMETRES DE L'API QMHSNDPM ?I* MESSAGE IDENTIFIER I DS I 1 7 QSNDID ?I* MESSAGE FILE I DS I 1 20 QSNDFL I 1 10 QSNDFI I I '*LIBL' 11 20 QSNDLI ?I* MESSAGE DATA I DS I 1 132 QSNDDA ?I* LENGTH OF MESSAGE DATA I DS I I 132 B 1 40QSNDDL ?I* MESSAGE TYPE I DS I I '*DIAG' 1 10 QSNDTY ?I* CALL STACK ENTRY I DS I I '*' 1 10 QSNDSE ?I* CALL STACK COUNTER I DS I I 1 B 1 40QSNDSC ?I* MESSAGE KEY I DS I I ' ' 1 4 QSNDMK ?I******************** ?I* ?I* ERROR CODE HANDLING FIELDS ?I* ?I******************** IECH DS ?I* LONGUEUR DE LA ZONE I I 255 B 1 40ECH01 ?I* LONGUEUR DE LA REPONSE I B 5 80ECH02 ?I* NUMERO DE L'ERREUR I 9 15 ECH03 ?I* MESSAGE DATA POUR L'ERREUR I 17 255 ECH05 I 17 117 ECH5A IPMQR03 DS ? ***************************************************************** ? * ? * DESCRIPTION PARAMETRE POUR MODULE QMHSNDPM ? * ? *---------------------------------------------------------------* ? * MODELE CLASSIQUE D'UTILISATION DE CE MODULE ? * .../... ? *NETTOYER LE PMQSFL ? * CALL 'PMQR02' ? * .../... ? *CONTROLE DE ZONE ? * ZONE IFNE CORRECT ? * MOVEL'CPF9898' PMQ03A ? * MOVEL'QCPFMSG' PMQ03B ? * MOVELX'29480D' PMQ03C ? * CALL 'PMQR03' ? * PARM PMQR03 ? * .../... ? * WRITEPMQCTL ?I* MESSAGE IDENTIFIER I 1 7 PMQ03A ?I* MESSAGE FILE (DANS *LIBL !) I 9 19 PMQ03B ?I* MESSAGE DATA I 21 152 PMQ03C ? *================================================================ C *ENTRY PLIST C PARM PMQR03 ? *================================================================ ? * Send message to program's message queue ? *================================================================ ? * If no message file specified, use default B01 C PMQ03B IFEQ *BLANK C MOVEL'QCPFMSG' PMQ03B E01 C END C MOVELPMQ03B QSNDFI C CALL 'QMHSNDPM' C PARM PMQ03A QSNDID C PARM QSNDFL C PARM PMQ03C QSNDDA C PARM QSNDDL C PARM QSNDTY C PARM QSNDSE C PARM QSNDSC C PARM QSNDMK C PARM ECH ?C* B01 C ECH03 IFNE *BLANK C MOVELECH03 SPMSID C 'ERR S/' CAT 'QMHSNDPM'SPMSDA P C EXSR *PSSR E01 C ENDIF ? * Clear all fields for default mechanism next time C MOVEL*BLANK PMQ03A C MOVEL*BLANK PMQ03B C MOVEL*BLANK PMQ03C C SETON RT ?C*=------------------------------------------------------------------ C *PSSR BEGSR C DUMP C ENDSR'*CANCL' ?C*=------------------------------------------------------------------
    0 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: