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


  • Subject: Re: Sending messages from an RPG pgm
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Thu, 29 Jan 98 23:08:28 +1100

There are a number of possibilities:

Firstly you cannot use the QCMDEXC program to issue a SNDPGMMSG command because 
that command supports 
a return value for the message key (the KEYVAR keyword).  The return value is a 
variable which must 
be declared in the calling program and it is not possible to address the 
caller's storage via 
QCMDEXC.

SNDMSG and SNDBRKMSG send messages to *MSGQ objects only.  If you wish to send 
a message to an 
external source i.e., a user (QSYSOPR, or a permanent message queue) then these 
commands will work 
via QCMDEXC but they are a clumsy approach.

If you wish to send the message to a program lower in the stack then you must 
use either SNDPGMMSG or 
the QMHSNDPM (Q Message Handler Send Program Message) API.  Note that there are 
APIs which provide 
the equivalent function to SNDMSG and SNDBRKMSG.

To use SNDPGMMSG from any high-level (HLL) language you must call a CL program. 
 Since you need to 
write the CL program and pay the cost of invoking CL from a HLL it would be 
more efficient to call 
the QMHSNDPM API directly from the HLL.

None of the above mentioned techniques will stop your HLL from continuing 
execution unless you send 
the message as an *ESCAPE, *NOTIFY, or *STATUS message to a program lower in 
the invocation (call) 
stack -- in the case of the *STATUS message the receiving program must be 
monitoring for the message 
identifier; the other message types will cause your HLL to stop immediately, 
control will be given to 
either the receiving program (if it is monitoring for the exception) or the 
sytem exception handler.

The preferred method is to use the QMHSNDPM API or the SNDPGMMSG command via a 
CL program.  In either 
case you will have to pass parameters etc .....

If this is not clear enough let me know and I shall try to clarify.

Regards,
Simon Coulter.

** Close Windoze at Warp speed

//----------------------------------------------------------
// FlyByNight Software
// AS/400 Technical Specialists
// Phone: +61 3 9419 0175
// Fax:   +61 3 9419 0175
// Mob:   +61 3 0411 091 400
// Email: shc@flybynight.com.au

//--- forwarded letter -------------------------------------------------------
> Date: Wed, 28 Jan 98 20:54:09 -0500
> From: "Lynn Folk" <lfolk@nbn.net>
> To: "'Midrange'" <MIDRANGE-L@midrange.com>
> Reply-To: MIDRANGE-L@midrange.com
> Subject: Sending messages from an RPG pgm

> 
> Hey all or anyone,
> Could anyone tell me before the fact........If I use QCMDEXC from an RPG 
>program to execute a send 
message command and I am running the program through a submit job, which send 
message command should 
or could I use that will not cause the program to stop executing before the 
processing is complete. 
(i.e. SNDPGMMSG, SNDMSG, SNDBRKMSG) Or can I even do it that way ? I had really 
rather hoped I 
wouldn't have to get into passing parms to a CL program and etc...... at the 
end of the processing, 
but then again I don't think that would serve my purpose either as the messages 
I need to send are 
dependant on the outcome of the processing. 
> Lynn
  

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.