220 lines
15 KiB
HTML
220 lines
15 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="task" />
|
||
|
<meta name="DC.Title" content="Send messages from a CL program" />
|
||
|
<meta name="abstract" content="Various message types are described in this topic. Use the Send Program Message (SNDPGMMSG) command or the Send User Message (SNDUSRMSG) command to send a message from a CL procedure or program." />
|
||
|
<meta name="description" content="Various message types are described in this topic. Use the Send Program Message (SNDPGMMSG) command or the Send User Message (SNDUSRMSG) command to send a message from a CL procedure or program." />
|
||
|
<meta name="DC.subject" content="message, sending from CL program, control language (CL), program, sending message, message queue, sending message from program to, SNDPGMMSG (Send Program Message) command, use, Send Program Message (SNDPGMMSG) command, command, CL, SNDPGMMSG (Send Program Message), Send Program Message (SNDPGMMSG), program message, sending, message type table, message queue type table, CCSID" />
|
||
|
<meta name="keywords" content="message, sending from CL program, control language (CL), program, sending message, message queue, sending message from program to, SNDPGMMSG (Send Program Message) command, use, Send Program Message (SNDPGMMSG) command, command, CL, SNDPGMMSG (Send Program Message), Send Program Message (SNDPGMMSG), program message, sending, message type table, message queue type table, CCSID" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="wmsgs.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="iimsg.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="codim.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="stmsg.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="enmsg.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="xsmsg.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="callid.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="msgsu.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="exdmg.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rqmsg.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../rzahb/rzahbmsq.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="callidbyname.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="msgcl" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Send messages from a CL program</title>
|
||
|
</head>
|
||
|
<body id="msgcl"><a name="msgcl"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Send messages from a CL program</h1>
|
||
|
<div><p>Various message types are described in this topic. Use the <span class="cmdname">Send
|
||
|
Program Message (SNDPGMMSG)</span> command or the <span class="cmdname">Send User Message
|
||
|
(SNDUSRMSG)</span> command to send a message from a CL procedure or program.</p>
|
||
|
<div class="section"> <p>Using the <span class="cmdname">Send Program Message (SNDPGMMSG)</span> command,
|
||
|
you can send the following types of messages:</p>
|
||
|
<ul><li>Informational</li>
|
||
|
<li>Inquiry</li>
|
||
|
<li>Completion</li>
|
||
|
<li>Diagnostic</li>
|
||
|
<li>Request</li>
|
||
|
<li>Escape</li>
|
||
|
<li>Status</li>
|
||
|
<li>Notify</li>
|
||
|
</ul>
|
||
|
<p>You can send messages from a CL procedure or program to the following
|
||
|
types of queues: </p>
|
||
|
<ul><li>External message queue of the requester of the job </li>
|
||
|
<li>Call message queue of a program or procedure called by the job </li>
|
||
|
<li>System operator message queue</li>
|
||
|
<li>Workstation message queue</li>
|
||
|
<li>User message queue</li>
|
||
|
</ul>
|
||
|
<p>To send a message from a procedure or program, you can specify the
|
||
|
following on the SNDPGMMSG command: </p>
|
||
|
<ul><li>Message identifier or an immediate message. The message identifier is
|
||
|
the name of the message description for a predefined message.</li>
|
||
|
<li>Message file. The name of the message file containing the message description
|
||
|
when a predefined message is sent.</li>
|
||
|
<li>Message data fields. If a predefined message is sent, these fields contain
|
||
|
the values for the substitution variables in the message. The format of each
|
||
|
field must be described in the message description. If an immediate message
|
||
|
is sent, there are no message data fields.</li>
|
||
|
<li>Message queue or user to receive the message.</li>
|
||
|
<li> Message type. The following indicates which types of messages can be
|
||
|
sent to which types of queues (V = valid).</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><caption>Table 1. Valid Message Types for Message
|
||
|
Queue Types</caption><thead align="left"><tr><th rowspan="2" align="left" valign="top" width="16.477272727272727%" id="d0e136">Message Type</th>
|
||
|
<th colspan="5" align="center" valign="top" id="d0e138">Message
|
||
|
Queue Type</th>
|
||
|
</tr>
|
||
|
<tr><th align="left" valign="top" width="16.477272727272727%" id="d0e141">External</th>
|
||
|
<th align="left" valign="top" width="14.962121212121213%" id="d0e143">Call</th>
|
||
|
<th align="left" valign="top" width="18.939393939393938%" id="d0e145">QSYSOPR</th>
|
||
|
<th align="left" valign="top" width="20.265151515151516%" id="d0e147">WorkStation</th>
|
||
|
<th align="left" valign="top" width="12.878787878787879%" id="d0e149">User</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td align="left" valign="top" width="16.477272727272727%" headers="d0e136 ">Informational</td>
|
||
|
<td align="left" valign="top" width="16.477272727272727%" headers="d0e138 d0e141 "> V</td>
|
||
|
<td align="left" valign="top" width="14.962121212121213%" headers="d0e138 d0e143 "> V</td>
|
||
|
<td align="left" valign="top" width="18.939393939393938%" headers="d0e138 d0e145 "> V</td>
|
||
|
<td align="left" valign="top" width="20.265151515151516%" headers="d0e138 d0e147 "> V</td>
|
||
|
<td align="left" valign="top" width="12.878787878787879%" headers="d0e138 d0e149 "> V</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="16.477272727272727%" headers="d0e136 ">Inquiry</td>
|
||
|
<td align="left" valign="top" width="16.477272727272727%" headers="d0e138 d0e141 "> V</td>
|
||
|
<td align="left" valign="top" width="14.962121212121213%" headers="d0e138 d0e143 "> </td>
|
||
|
<td align="left" valign="top" width="18.939393939393938%" headers="d0e138 d0e145 "> V</td>
|
||
|
<td align="left" valign="top" width="20.265151515151516%" headers="d0e138 d0e147 "> V</td>
|
||
|
<td align="left" valign="top" width="12.878787878787879%" headers="d0e138 d0e149 "> V</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="16.477272727272727%" headers="d0e136 ">Completion</td>
|
||
|
<td align="left" valign="top" width="16.477272727272727%" headers="d0e138 d0e141 "> V</td>
|
||
|
<td align="left" valign="top" width="14.962121212121213%" headers="d0e138 d0e143 "> V</td>
|
||
|
<td align="left" valign="top" width="18.939393939393938%" headers="d0e138 d0e145 "> V</td>
|
||
|
<td align="left" valign="top" width="20.265151515151516%" headers="d0e138 d0e147 "> V</td>
|
||
|
<td align="left" valign="top" width="12.878787878787879%" headers="d0e138 d0e149 "> V</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="16.477272727272727%" headers="d0e136 ">Diagnostic</td>
|
||
|
<td align="left" valign="top" width="16.477272727272727%" headers="d0e138 d0e141 "> V</td>
|
||
|
<td align="left" valign="top" width="14.962121212121213%" headers="d0e138 d0e143 "> V</td>
|
||
|
<td align="left" valign="top" width="18.939393939393938%" headers="d0e138 d0e145 "> V</td>
|
||
|
<td align="left" valign="top" width="20.265151515151516%" headers="d0e138 d0e147 "> V</td>
|
||
|
<td align="left" valign="top" width="12.878787878787879%" headers="d0e138 d0e149 "> V</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="16.477272727272727%" headers="d0e136 ">Request</td>
|
||
|
<td align="left" valign="top" width="16.477272727272727%" headers="d0e138 d0e141 "> V</td>
|
||
|
<td align="left" valign="top" width="14.962121212121213%" headers="d0e138 d0e143 "> V</td>
|
||
|
<td align="left" valign="top" width="18.939393939393938%" headers="d0e138 d0e145 "> </td>
|
||
|
<td align="left" valign="top" width="20.265151515151516%" headers="d0e138 d0e147 "> </td>
|
||
|
<td align="left" valign="top" width="12.878787878787879%" headers="d0e138 d0e149 "> </td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="16.477272727272727%" headers="d0e136 ">Escape</td>
|
||
|
<td align="left" valign="top" width="16.477272727272727%" headers="d0e138 d0e141 "> </td>
|
||
|
<td align="left" valign="top" width="14.962121212121213%" headers="d0e138 d0e143 "> V</td>
|
||
|
<td align="left" valign="top" width="18.939393939393938%" headers="d0e138 d0e145 "> </td>
|
||
|
<td align="left" valign="top" width="20.265151515151516%" headers="d0e138 d0e147 "> </td>
|
||
|
<td align="left" valign="top" width="12.878787878787879%" headers="d0e138 d0e149 "> </td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="16.477272727272727%" headers="d0e136 ">Status</td>
|
||
|
<td align="left" valign="top" width="16.477272727272727%" headers="d0e138 d0e141 "> V</td>
|
||
|
<td align="left" valign="top" width="14.962121212121213%" headers="d0e138 d0e143 "> V</td>
|
||
|
<td align="left" valign="top" width="18.939393939393938%" headers="d0e138 d0e145 "> </td>
|
||
|
<td align="left" valign="top" width="20.265151515151516%" headers="d0e138 d0e147 "> </td>
|
||
|
<td align="left" valign="top" width="12.878787878787879%" headers="d0e138 d0e149 "> </td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="16.477272727272727%" headers="d0e136 ">Notify</td>
|
||
|
<td align="left" valign="top" width="16.477272727272727%" headers="d0e138 d0e141 "> V</td>
|
||
|
<td align="left" valign="top" width="14.962121212121213%" headers="d0e138 d0e143 "> V</td>
|
||
|
<td align="left" valign="top" width="18.939393939393938%" headers="d0e138 d0e145 "> </td>
|
||
|
<td align="left" valign="top" width="20.265151515151516%" headers="d0e138 d0e147 "> </td>
|
||
|
<td align="left" valign="top" width="12.878787878787879%" headers="d0e138 d0e149 "> </td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<ul><li>Coded character set identifier (CCSID). Specifies the coded character
|
||
|
set identifier (CCSID) that the supplied message or message data is in. </li>
|
||
|
<li>Reply message queue. The name of the message queue that receives the reply
|
||
|
to an inquiry message. By default, the reply is sent to the call message queue
|
||
|
of the procedure or program that sent the inquiry message.</li>
|
||
|
<li>Key variable name. The name of the CL variable to contain the message
|
||
|
reference key for a message.</li>
|
||
|
</ul>
|
||
|
<p>To send the message created in <a href="exdmg.htm#exdmg">Example: Describe a message</a>,
|
||
|
you would use the following command: </p>
|
||
|
<pre>SNDPGMMSG MSGID(USR4310) MSGF(QGPL/USRMSG) +
|
||
|
MSGDTA(&CUSNO) TOPGMQ(*EXT) +
|
||
|
MSGTYPE(*INFO)</pre>
|
||
|
<p>The substitution variable for the message is the customer number.
|
||
|
Because the customer number varies, you cannot specify the exact customer
|
||
|
number in the message. Instead, declare a CL variable in the CL procedure
|
||
|
or program for the customer number (&CUSNO). Then specify this variable
|
||
|
as the message data field. When the message is sent, the current value of
|
||
|
the variable is passed in the message: </p>
|
||
|
<pre>Customer number 35500 not found</pre>
|
||
|
<p>In addition, you do not always know which display station is
|
||
|
using the procedure or program, so you cannot specify the exact display station
|
||
|
message queue that the message is to be sent to (TOMSGQ parameter); therefore,
|
||
|
you specify the external message queue *EXT on the TOPGMQ parameter.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="iimsg.htm">Inquiry and informational messages</a></strong><br />
|
||
|
Using the <span class="cmdname">Send User Message (SNDUSRMSG)</span> command,
|
||
|
you can send an inquiry message or an informational message to a display station
|
||
|
user, the system operator, or a user-defined message queue. </li>
|
||
|
<li class="ulchildlink"><strong><a href="codim.htm">Completion and diagnostic messages</a></strong><br />
|
||
|
Using the <span class="cmdname">Send User Message (SNDUSRMSG)</span> command,
|
||
|
you can send diagnostic and completion messages.</li>
|
||
|
<li class="ulchildlink"><strong><a href="stmsg.htm">Status messages</a></strong><br />
|
||
|
You can send status messages from your CL procedure or program,
|
||
|
using the <span class="cmdname">Send Program Message (SNDPGMMSG)</span> command, to
|
||
|
the external message queue (*EXT) for the job or to a call message queue .
|
||
|
</li>
|
||
|
<li class="ulchildlink"><strong><a href="enmsg.htm">Escape and notify messages</a></strong><br />
|
||
|
You can send both escape and notify messages from your CL procedure or program to message queues.</li>
|
||
|
<li class="ulchildlink"><strong><a href="xsmsg.htm">Examples: Send messages</a></strong><br />
|
||
|
This topic contains six message examples: send a completion message,
|
||
|
send a completion message with variable text, send an inquiry message and
|
||
|
receive its reply, send an inquiry message and receive a reply with <span class="cmdname">Send
|
||
|
User Message (SNDUSRMSG)</span>, send an escape message, and send an informational
|
||
|
message to multiple users. </li>
|
||
|
<li class="ulchildlink"><strong><a href="callid.htm">Identify a call stack entry</a></strong><br />
|
||
|
If a CL procedure is to send a message to an OPM program or another ILE procedure, you must identify the call stack entry to which the message is sent.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="wmsgs.htm" title="This discusses some of the ways that messages can be used to communicate between users and programs.">Messages</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="callidbyname.htm" title="You can identify the base call stack entry by providing the name of the OPM program or ILE procedure running in that entry.">Identify the base entry by name</a></div>
|
||
|
</div>
|
||
|
<div class="reltasks"><strong>Related tasks</strong><br />
|
||
|
<div><a href="msgsu.htm" title="Several commands can be used to send messages to system users.">Send messages to a system user</a></div>
|
||
|
<div><a href="exdmg.htm" title="This example shows how to create a message to be used in an application.">Example: Describe a message</a></div>
|
||
|
<div><a href="rqmsg.htm" title="Receiving request messages is a method for your CL procedure or program to process CL commands.">Receive request messages</a></div>
|
||
|
</div>
|
||
|
<div class="relinfo"><strong>Related information</strong><br />
|
||
|
<div><a href="../rzahb/rzahbmsq.htm">Types of message queues</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|